php4

Cannot re-assign $this?

允我心安 提交于 2019-12-22 10:48:58
问题 I have a script on a server that had php version 4. Now it is changed to php5 and the script does not function any more. I get this error: Fatal error: Cannot re-assign $this in URL database.php line 88 In the file is a class that has a function. Inside is the line 88: $this = new $db( $serv, $user, $pass, $dbName ); What does the error mean and how can I change it? 回答1: $this is a special "variable" that always refers to the object the current function is executing in. It only makes sense

Regex for html attributes in php

主宰稳场 提交于 2019-12-20 07:35:57
问题 I am trying to parse a string of HTML tag attributes in php. There can be 3 cases: attribute="value" //inside the quotes there can be everything also other escaped quotes attribute //without the value attribute=value //without quotes so there are only alphanumeric characters can someone help me to find a regex that can get in the first match the attribute name and in the second the attribute value (if it's present)? 回答1: Give this a try and see if it is what you want to extract from the tags.

Regex for html attributes in php

删除回忆录丶 提交于 2019-12-20 07:33:47
问题 I am trying to parse a string of HTML tag attributes in php. There can be 3 cases: attribute="value" //inside the quotes there can be everything also other escaped quotes attribute //without the value attribute=value //without quotes so there are only alphanumeric characters can someone help me to find a regex that can get in the first match the attribute name and in the second the attribute value (if it's present)? 回答1: Give this a try and see if it is what you want to extract from the tags.

How can I find out the date of the day before a date?

强颜欢笑 提交于 2019-12-19 03:43:50
问题 I have a system that compares fiscal year up to the current date to the same date range of the year before. You can adjust the year and month to look at and it always compares the same date range to the year previous. I have it set so if the current day is leap day it compares to the 28th of last year, and if last year was leap year and today is feb 28th it compares to last year up to 29th. if you look at a month other than the current month it shows up to the last day of that month,

php4 with json data

∥☆過路亽.° 提交于 2019-12-18 09:44:37
问题 Can someone help me to setup php4 for using json? Thanks! 回答1: Haven't tried this myself but you can have a look over here... How to use JSON in PHP 4 or PHP 5.1.x Googling up the "json in php4" should give some handy results. 回答2: This also looks like it may be a viable option http://willshouse.com/2009/06/12/using-json_encode-and-json_decode-in-php4/ 来源: https://stackoverflow.com/questions/3481927/php4-with-json-data

How to make a class property private in PHP4?

人走茶凉 提交于 2019-12-13 06:47:21
问题 in PHP4 there is no public,private,etc. So I am wondering if there is some sort of work-around so that I can make a class's property private and only accessible via getter/setter Thanks!! 回答1: You could approach this with a distinct syntax that clearly discourages the usage of such properties. You could borrow the python syntax of starting the method name with an underscore to define it as private. This doesn't block anyone from using it, of course, but its usage will be discouraged. 回答2: You

php session and path setting

早过忘川 提交于 2019-12-13 03:42:17
问题 I would like to separate my source folders into two: The folders that contain the code that you type into the address bar and those that make up parts of the page (tiles) and other code (classes, etc). So at the start of every php file I added: <?php // index.php include("config.php"); include("session.php"); ?> Config contains just this so far, but allows me to expand if I need other directories (logs, etc.) <?php // config.php $_PATHS["base"] = dirname(dirname(__FILE__)) . "\\"; $_PATHS[

unable to sort date using usort

纵然是瞬间 提交于 2019-12-12 17:19:08
问题 I have user defined function sort which sorts by date. It works fine for the same year and does not work when the year changes. This an example of the dates that is sorted by the function: 01/02/2013 01/03/2013 12/12/2012 function mysort($a,$b) { return $a['date']>$b['date']; } usort($arr,"mysort"); This is an old application which uses php4. Is there a way where I can compare dates directly? 回答1: Use strtotime. function mysort($a,$b) { return strtotime($a['date'])>strtotime($b['date']); } 来源

Why PHP APC cache miss in increasing all the time

◇◆丶佛笑我妖孽 提交于 2019-12-12 16:27:59
问题 I am using apc.php to check the PHP APC's stats (http://svn.php.net/viewvc/pecl/apc/trunk/apc.php) I have the following stats on a fairly busy server Cached Files 317 ( 26.3 MBytes) Hits 51483 Misses 6814 The problem is the Misses is always increasing (given a limited number of files), are there any way to check which files are missed? Another question is: The Cached Files is total consuming 26.3MBytes, does it mean every Apache child process is using 26.3MBytes? 回答1: You do know what apc

PHP Framework support for legacy PHP4?

☆樱花仙子☆ 提交于 2019-12-12 01:15:30
问题 I know that PHP4 is "dead", however there are about two dozen or so of our clients that still are located on servers where PHP4 is used, and we won't get any server upgrades until around a year or two. I'm just about to start working on refactoring and improving our core web framework, which is now coded for the lowest common denominator, PHP4 ( eg all classes have var $foo ). I've never done any OO in PHP4 but I'm wondering if I should make different classes for the PHP versions, and based