Questions tagged [php-5.2]

PHP 5.2 (now past End of Life) is the successor to PHP 5.1. It was released on November 2, 2006. Use this tag for version-specific issues relating to specifically to PHP 5.2.

PHP is a widely-used, general-purpose scripting language designed specifically for web development, though it has since been extended to other applications too. PHP is the most popular language for web development, powering over 20 million websites.

Note that support for PHP 5.2 has been officially discontinued. There are no externally supported versions of 5.2 (i.e. backported security fixes) so it is highly recommended you upgrade to a supported version.

Information

  • If you want to talk about PHP or if you have a question, you can come to Chat Room 11: PHP.
  • For global question on PHP, please use the generic tag:
247 questions
10
votes
2 answers

Immitate PHP 5.3 DateTime in PHP 5.2

I was playing with the DateTime object in PHP 5.3 on my local machine and made something useful but my host (NFS) is only running 5.2 and doesn't plan to upgrade until 5.3.1 is out. So my question is, is this code possible using 5.2? Specifically,…
aland
  • 1,562
  • 2
  • 22
  • 39
10
votes
1 answer

Get large list of files, sorted by file time in *milliseconds*

I know my file system is storing the file modification time in milliseconds but I don't know of a way to access that information via PHP. When I do an ls --full-time I see this: -rw-r--r-- 1 nobody nobody 900 2012-06-29 14:08:37.047666435 -0700…
Jeremy
  • 214
  • 2
  • 8
7
votes
2 answers

`new` and `use` keyword paths

Im on a host company that uses php 5.2 , some of the libraries i use are written in 5.3 and there are certain incompatibilities between the code. First of all what is the alternative to : use \folder1\folder2\class_file; Secondly what is the…
John Papastergiou
  • 959
  • 2
  • 14
  • 28
7
votes
2 answers

Doctrine 1.2 hydration fails with HYDRATION_RECORD, but works with HYDRATION_ARRAY

I have a code that runs perfectly with Doctrine_Core::HYDRATION_ARRAY, but crashes with Doctrine_Core::HYDRATION_RECORD. The page is loading for about two minutes and shows standard browser error message, which is something like Connection to the…
J0HN
  • 23,930
  • 5
  • 46
  • 83
7
votes
2 answers

PHP Object Life Time

I am using PHP 5.2. If I new an object at one page, when will this object be destructed? Is the object destructed automatic at the time that user go to another .php page or I need to call __destructor explicitly?
Terminal User
  • 803
  • 3
  • 12
  • 21
7
votes
2 answers

Can't call static method from class as variable name?

I'm using php 5.2.6. I have a strategy pattern, and the strategies have a static method. In the class that actually implements one of the strategies, it gets the name of the strategy class to instantiate. However, I wanted to call one of the static…
user151841
  • 15,348
  • 28
  • 93
  • 156
6
votes
5 answers

Unexpected T_PAAMAYIM_NEKUDOTAYIM in PHP 5.2.x

I'm having a hard time understanding why I'm getting an Unexpected T_PAAMAYIM_NEKUDOTAYIM error in the following code, which seems perfecly valid to me... class xpto { public static $id = null; public function __construct() { } …
Alix Axel
  • 141,486
  • 84
  • 375
  • 483
6
votes
3 answers

Can you hint return types in PHP 5.2.5?

I think my eclipse's ctrl+clicking links might benefit greatly... Edit: I'm using eclipse PDT. Edit 2: I'm very happy with the solution of putting docblocks before functions (and variables) with an @return or @var statement, I've just updated the…
Dean Rather
  • 29,230
  • 13
  • 59
  • 68
5
votes
2 answers

Adding X weeks to a date using PHP 5.2

My shared hosting package at 1and1 only includes PHP 5.2.17 -- so I can't use the DateTime object. Very annoying! I currently have this code $eventDate = new DateTime('2013-03-16'); // START DATE $finishDate = $eventDate->add(new…
Chuck Le Butt
  • 43,669
  • 58
  • 179
  • 268
5
votes
5 answers

PHP date_parse_from_format( ) alternative in PHP 5.2

Since date_parse_from_format( ) is available only in PHP 5.3, I need to write a function that mimics its behaviour in PHP 5.2. Is it possible to write this function for PHP 5.2 and make it work exactly the same way that it does in PHP 5.3?…
Acacio
  • 110
  • 1
  • 1
  • 7
5
votes
3 answers

PHP HTTP-Request

I have MAMP Pro installed running php 5.2.13. When I try to initialize a HTTP-Request $r = new HttpRequest('http://example.com/', HttpRequest::METH_GET); it tells me: "Class 'HttpRequest' not found in ...". What do I need to do to 'install(?)'…
JNK
  • 1,693
  • 8
  • 24
  • 36
5
votes
5 answers

php function doesn't return a value

I have a class which works fine with php 5.3 (XAMPP 1.7.3, windows 7) but doesn't work in my server(php 5.2.17 - Safe mode On): connection =…
undone
  • 7,702
  • 4
  • 40
  • 68
5
votes
1 answer

How to downgrade PHP version from 5.3 to 5.2 in Ubuntu 12.04?

I have freshly installed Ubuntu 12.04 and I have installed PHP as well. By default, it is installed with version 5.3.10 but my PHP project doesn't support PHP v5.3.10. I want to downgrade PHP version to 5.2. How can I do it?
Manojkumar
  • 1,301
  • 4
  • 32
  • 49
4
votes
3 answers

Preventing DOMDocument::loadHTML() from converting entities

I have a string value that I'm trying to extract list items for. I'd like to extract the text and any subnodes, however, DOMDocument is converting the entities to the character, instead of leaving in the original state. I've tried setting…
Reuben
  • 3,656
  • 2
  • 39
  • 53
4
votes
4 answers

Closure objects within arrays before PHP 5.3

I know it's possible to do the following with PHP 5.3 (anonymous functions), but is there a similar alternative in older PHP version (pre-5.3)? $exampleArray = array( 'func' => function() { echo 'this is an example'; } Is it…
Dominique
  • 374
  • 4
  • 15
1
2
3
16 17