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:
1291 questions
6
votes
2 answers

PHP namespaces: equivalent to C# using

What is the equivalent of C#'s using Name.Space; statement to make all classes of that namespace available in the current file? Is this even possible with PHP? What I'd like (but does not work):
knittl
  • 246,190
  • 53
  • 318
  • 364
6
votes
2 answers

PHP namespaced function best practices

I have a few general use functions that do not really make sense in any class as static methods. I would like to encapsulate them under a namespace so there are no conflicts with functions defined in the global scope. For my namespaced classes, I…
rr.
  • 6,484
  • 9
  • 40
  • 48
6
votes
3 answers

MVC PHP - Sending mail from Model

I am having problem to figure whenever I should send mail from the Model or the Controller. The thing is In the controller i use like This is regarding PHP. In Controller: if (Post::get()){ $this->model->registerUser( ... ); …
Jonatan
  • 61
  • 1
  • 3
6
votes
3 answers

New to PHP. Should I learn PCRE or POSIX. (saying both won't be helpful)

I was looking at a website that said use of POSIX is dying out in PHP 5.3. I was also working though a video ISO (from around 2005) that said I should stick to POSIX if I'm new to PHP and have never programmed in Python. I've read that PCRE is…
Glacius
  • 127
  • 1
  • 8
6
votes
2 answers

Error message: Fatal error: Can't use function return > value in write context in

I am trying to run some code from a book. There appears to be a problem with the code. Here is the error message: Fatal error: Can't use function return value in write context in /Applications/MAMP/htdocs/Eclipse-Workspace/simpleblog/test.php …
ntc
  • 257
  • 1
  • 4
  • 9
6
votes
5 answers

DateTime in php with timezone

I have a question. I try to use datetime in php. I did : $now = new \DateTime(); When I print_r the $now I have : DateTime Object ( [date] => 2016-12-01 05:55:01 [timezone_type] => 3 [timezone] => Europe/Helsinki ) When I look at clock I…
Harea Costicla
  • 797
  • 3
  • 9
  • 20
6
votes
4 answers

How to upload 2 separate images in codeigniter

i want to upload 2 image separately. i have a condition in which i need to upload file and some time bohth and some time only image i need to use separate button how to differentiate both image and file. my codes are
sheraz iqbal
  • 91
  • 2
  • 9
6
votes
4 answers

PHP days difference calculation error

I have some PHP code to calculate the number of days between two specific dates. The difference should not count Sundays and Saturdays. Also, I have an array of dates, which includes holidays, which also need to be skipped. I gave the starting date…
Alfred
  • 21,058
  • 61
  • 167
  • 249
6
votes
6 answers

How do you upgrade MAMP's PHP to PHP 5.3 ?

I haven't been able to find any resources on how to do this.. Anyone have any ideas or resources?! I've tried changing the ./configure options and I'm solving things one at a time but it seems like this method could take forever.. My current error…
Matt
  • 22,224
  • 25
  • 80
  • 116
6
votes
3 answers

How to match horizontal ellipse (…) in php

I want to replace the horizontal ellipse (…) with three period (...)in a given string. Till now I have tried are: str_replace('…','...', $text); str_replace('…', '...', $text); str_replace('&hellips', '...', $text); But not able to get the…
jimy
  • 4,848
  • 3
  • 35
  • 52
6
votes
1 answer

What is the maximum string input in crypt() function?

I think I have reached the limit for crypt($string) at 72 chars. Here is the code:
Glavić
  • 42,781
  • 13
  • 77
  • 107
5
votes
1 answer

Process socket data with a leading length value

This is a follow-up question about how to process prefixed messages received from a network socket. What I try to do is: Read the first 4 bytes (which is the $prefix and represents the length of the message) Check if $prefix has really the size of…
Mike
  • 1,992
  • 4
  • 31
  • 42
5
votes
2 answers

PHP DateTime Functions

I have the following code fragment: $now = '2011-12-01 22:32:33'; $datetime = '2011-12-01 00:07:27'; $nowObj = new DateTime($now); $datetimeObj = new DateTime($datetime); $diff = $datetimeObj->diff($nowObj); //leaving this in screws up the next…
cdub
  • 24,555
  • 57
  • 174
  • 303
5
votes
1 answer

Are functions like strip_tags() and trim() UTF-8 aware?

I'm wondering whether functions like strip_tags() and trim() UTF-8 aware? I found this on the web, but I'm not sure about it: strip_tags(): multi-byte UTF-8 characters contain no byte sequences that resemble less-than or greater-than…
entropid
  • 6,130
  • 5
  • 32
  • 45
5
votes
3 answers

How to add some symbol to every word in string?

I am looking for fast and good way to add "-" before every word in string. For example "bla bla bla" should become "-bla -bla -bla". I don't want to make an array of this string, then map it, etc. It looks like a wrong and slow way. Do you have any…
VitalyP
  • 1,867
  • 6
  • 22
  • 31