php4

PHP object class variable

荒凉一梦 提交于 2019-12-01 20:30:45
I have built a class in PHP and I must declare a class variable as an object. Everytime I want to declare an empty object I use: $var=new stdClass; But if I use it to declare a class variable as class foo { var $bar=new stdClass; } a parse error occurs. Is there a way to do this or must I declare the class variable as an object in the constructor function? PS: I'm using PHP 4. You can only declare static values this way for class members, i.e. ints , strings , bools , arrays and so on. You can't do anything that involves processing of any kind, like calling functions or creating objects. You

PHP4: Send XML over HTTPS/POST via cURL?

。_饼干妹妹 提交于 2019-12-01 16:34:51
I wrote a class/function to send xml over https via PHP4/cURL, just wondering if this is the correct approach, or if there's a better one. Note that PHP5 is not an option at present. /** * Send XML via http(s) post * * curl --header "Content-Type: text/xml" --data "<?xml version="1.0"?>...." http://www.foo.com/ * */ function sendXmlOverPost($url, $xml) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // For xml, change the content-type. curl_setopt ($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml")); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);

Get date of Monday in current week in PHP 4 [duplicate]

☆樱花仙子☆ 提交于 2019-11-30 13:55:57
问题 This question already has answers here : Get date for monday and friday for the current week (PHP) (8 answers) Closed 6 years ago . I need to find the date of Monday in the current week. How can I do this in PHP 4? 回答1: Easisest way: $time = strtotime('monday this week'); 回答2: Try this: return strtotime('last monday', strtotime('next sunday')); 回答3: echo date('Y-m-d',time()+( 1 - date('w'))*24*3600); For next week: echo date('Y-m-d',time()+( 8 - date('w'))*24*3600); 1 for Monday, 2 Tuesday, 3

Get date of Monday in current week in PHP 4 [duplicate]

拈花ヽ惹草 提交于 2019-11-30 08:56:17
This question already has an answer here: Get date for monday and friday for the current week (PHP) 8 answers I need to find the date of Monday in the current week. How can I do this in PHP 4? Davidcologne Easisest way: $time = strtotime('monday this week'); Try this: return strtotime('last monday', strtotime('next sunday')); apis17 echo date('Y-m-d',time()+( 1 - date('w'))*24*3600); For next week: echo date('Y-m-d',time()+( 8 - date('w'))*24*3600); 1 for Monday, 2 Tuesday, 3 Wednesday and so on. Have a try. echo date('Y-m-d', strtotime('previous monday')); Just one note, though. You want to

php4 with json data

五迷三道 提交于 2019-11-29 18:14:51
Can someone help me to setup php4 for using json? Thanks! 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. 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

Difference between php 4 and php 5? [closed]

烂漫一生 提交于 2019-11-29 05:13:11
I'm in search of the web hosting space, and got to know the PHP version is 4.3 and MySQL Version 4.1 But i developed my application in MySQL version 5.x and PHP version 5.x Can anyone give me the differences in versions ? what all i cannot access now ? Thanks... PHP version 5 I look at as when PHP became a real language, for a whole bunch of reasons, but most importantly because it became possible to write respectable Object Oriented code. But don't deemphasize the difference between MySQL 4 and 5 - I think it's even deeper and more significant. MySQl 5 was when MySQL became a real relational

Difference between php 4 and php 5? [closed]

岁酱吖の 提交于 2019-11-27 22:40:57
问题 I'm in search of the web hosting space, and got to know the PHP version is 4.3 and MySQL Version 4.1 But i developed my application in MySQL version 5.x and PHP version 5.x Can anyone give me the differences in versions ? what all i cannot access now ? Thanks... 回答1: PHP version 5 I look at as when PHP became a real language, for a whole bunch of reasons, but most importantly because it became possible to write respectable Object Oriented code. But don't deemphasize the difference between

PHP: Loop through all months in a date range?

折月煮酒 提交于 2019-11-27 11:34:23
If I have a start date (say 2009-02-01 ) and an end date (say 2010-01-01 ), how can I create a loop to go through all the dates (months) in the range? Try $start = $month = strtotime('2009-02-01'); $end = strtotime('2011-01-01'); while($month < $end) { echo date('F Y', $month), PHP_EOL; $month = strtotime("+1 month", $month); } Mind the note http://php.net/manual/de/datetime.formats.relative.php Relative month values are calculated based on the length of months that they pass through. An example would be "+2 month 2011-11-30", which would produce "2012-01-30". This is due to November being 30

Official end of support for PHP4?

只谈情不闲聊 提交于 2019-11-27 09:44:38
Is there an official date for when support for PHP4 will end? I keep reading this date and that on various sites and blogs, but can't find anything on the PHP website. Am I overlooking something? PHP4 is already way past the support. I think support ended more than a year ago. Support was officially discontinued on 2007-12-31! PHP4 was no longer developed since 2007-12-31, although some security issues were still taken care of up until 2008-08-08. Just before that, the latest version of PHP4 was released, being PHP 4.4.9. Also interesting for those still supporting PHP4: MySQL 4.0 support has

php output with sleep()

拥有回忆 提交于 2019-11-27 09:08:21
I'm trying to run a loop every second for 25 seconds basically. for($i = 0; $i <= 25; $i += 1){ echo $i; sleep(1) } The thing is it doesn't output until it's fully done, so after the loop continues 25 times. Is there a way to do this so it will output before each sleep? and not wait until the full loop is complete? Thanks! What you're trying to achieve is incremental output to the browser from PHP. Whether this is achievable can depend on your server and how you're invoking PHP. PHP under FastCGI You're probably a bit more likely to run into this kind of problem when PHP is running under