Questions tagged [php-5.3]

PHP 5.3 (now past End of Life) is the successor to PHP 5.2. It was released on June 30, 2009. Use this tag for version-specific issues relating to specifically to PHP 5.3.

The last version of PHP 5.3 was 5.3.29, which was released on 14-Aug-2014. This version has reached its end of life and will no longer receive any updates.

PHP 5.3 caused many headaches for legacy software as a number of mechanisms PHP had relied on were deprecated (most notably register_globals and safe_mode). Many string search related functions were deprecated too, such as split() and ereg(). Much code written before PHP 5 (and some during) makes use of both these, and therefore a lot of older code base needed updating.

See https://php.net/manual/en/migration53.deprecated.php for a full list.

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:
1295 questions
1021
votes
29 answers

How do I use PHP to get the current year?

I want to put a copyright notice in the footer of a web site, but I think it's incredibly tacky for the year to be outdated. How would I make the year update automatically with PHP 4 or PHP 5?
JD Graffam
  • 10,315
  • 2
  • 16
  • 6
211
votes
6 answers

How to fix error with xml2-config not found when installing PHP from sources?

When I try to install php 5.3 stable from source on Ubuntu (downloading compressed installation file from http://www.php.net/downloads.php) and I run ./configure I get this error: configure: error: xml2-config not found. Please check your libxml2…
TroodoN-Mike
  • 14,537
  • 12
  • 50
  • 77
138
votes
5 answers

What is the difference between self::$bar and static::$bar in PHP?

What is the difference between using self and static in the example below? class Foo { protected static $bar = 1234; public static function instance() { echo self::$bar; echo "\n"; echo static::$bar; …
cwd
  • 47,510
  • 50
  • 154
  • 194
85
votes
3 answers

What is ?: in PHP 5.3?

Possible Duplicate: What are the PHP operators “?” and “:” called and what do they do? From http://twitto.org/
JasonDavis
  • 45,100
  • 92
  • 294
  • 508
84
votes
3 answers

What does 'P' stand for in the DateInterval format?

Consider the following example quoted from php manual for DateTime sub(new DateInterval('P10D')); echo $date->format('Y-m-d') . "\n"; ?> 'D' is for days, what does the 'P' stand for in that…
Shrinath
  • 6,892
  • 12
  • 45
  • 82
42
votes
3 answers

curl posting with header application/x-www-form-urlencoded

$post_data="dispnumber=567567567&extension=6"; $url="http://xxxxxxxx.xxx/xx/xx"; I need to post this $post_data using cURL php with header application/x-www-form-urlencoded i am new for curl any one help this out.
Saravanan M P
  • 471
  • 1
  • 7
  • 12
37
votes
10 answers

PHP Composer behind http proxy

I use composer on a network where the only way to access the internet is using HTTP or socks proxy. I have http_proxy and https_proxy environment variables. When compose tries to access HTTPS URLs I get this: file could not be downloaded: failed to…
Robert Dolca
  • 730
  • 2
  • 8
  • 14
35
votes
1 answer

LogicException vs. RuntimeException

I was wondering if there was a rule saying when to use which Exception in PHP... When do I have to throw a LogicException and when a RuntimeException? For example when it comes to exceptions like PageNotFoundException, from which exception class…
Nedec
  • 806
  • 10
  • 14
34
votes
1 answer

Self Executing functions in PHP5.3?

I was trying to borrow some programing paradigms from JS to PHP (just for fun). Is there a way of doing: $a = (function(){ return 'a'; })(); I was thinking that with the combination of use this can be a nice way to hide variables JS style $a =…
AriehGlazer
  • 1,982
  • 7
  • 22
  • 27
22
votes
4 answers

About PHP underscore naming convention (as in "_method" or "_property")

This is a sort of general inquiry I've been wondering about. I've noticed a lot of this through other people's code, and never really knew the actual reason, just followed the trends, so here goes. How come some methods and properties are named with…
Swader
  • 10,807
  • 14
  • 46
  • 82
22
votes
1 answer

2 php.ini files

I have found that: When I type the following on terminal: php -i | grep php.ini I get the output: The Loaded Configuration file is @ /etc/php5/cli/php.ini However, from phpinfo(), I get to see: The loaded ini file is @…
Hrishikesh Choudhari
  • 9,809
  • 17
  • 58
  • 73
22
votes
5 answers

Is there any replacement for PHPDocumentor that supports PHP 5.3?

Some of the new PHP 5.3 features, including namespaces and anonymous functions, are not compatible with PHPDocumentor, even with the latest release. For example, it just raises an error when it encounters "a function with no name", i.e. a closure.…
Ignas R
  • 3,234
  • 2
  • 20
  • 27
19
votes
1 answer

Parse error: syntax error, unexpected '[' with php 5.3

My script is working really fine on my xampp. Now I tried to upload it on the server, but it spat directly a Parse error: syntax error, unexpected '[' in my face. :( The line which its mocking about is this one: $item =…
Owl
  • 639
  • 5
  • 14
  • 26
17
votes
1 answer

Why do strings behave like an array in PHP 5.3?

I have this code: $tierHosts['host'] = isset($host['name']) ? $host['name'] : $host; It's working fine in PHP 5.5, but in PHP 5.3 the condition returns true while $host contains a string like pjba01. It returns the first letter of…
Ritesh
  • 4,049
  • 6
  • 22
  • 39
16
votes
1 answer

PHP forward_static_call vs call_user_func

What is the difference between forward_static_call and call_user_func And the same question applies to forward_static_call_array and call_user_func_array
Petah
  • 42,792
  • 26
  • 149
  • 203
1
2 3
86 87