Questions tagged [php-5.4]

PHP 5.4 is the successor to PHP 5.3. It was released on March 1, 2012. Use this tag for version-specific issues relating to specifically to PHP 5.4.

PHP 5.4 Changes:

  • Support for traits has been added.
  • Short array syntax has been added, e.g. $a = [1, 2, 3, 4]; or $a = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4];.
  • Function array dereferencing has been added, e.g. foo()[0].
  • Closures now support $this.
  • <?= is now always available, regardless of the short_open_tag php.ini option.
  • Class member access on instantiation has been added, e.g. (new Foo)->bar().
  • Class::{expr}() syntax is now supported.
  • Binary number format has been added, e.g. 0b001001101.
  • Improved parse error messages and improved incompatible arguments warnings.
  • The session extension can now track the upload progress of files.
  • Built-in development web server in CLI mode.

See Migrating from PHP 5.3.x to PHP 5.4.x for more information.

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:
402 questions
0
votes
0 answers

Why php versions 5.4.45 on server still can run code with "eregi" function?

why this function "eregi" its on server still running don't have error. but when I download this source code and gonna edit. its warning This function was DEPRECATED in PHP 5.3.0 , but I see this server use php 5.4.45 and I use php version 5.4.25…
0
votes
1 answer

CodeIgniter 3.1 not working in PHP 5.4 on Server

Getting 404 page not found error on Server , Whereas its working fine on local machine Below in my .htaccess RewriteEngine on RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico) RewriteCond…
Sameer
  • 1
  • 1
0
votes
0 answers

Disabling eval with .htaccess

For various reasons (for example, phpMyAdmin stops working), it is not practical (for those higher up) to disable eval by adding: [suhosin] suhosin.executor.disable_eval = On in php.ini. Can eval be disabled with .htaccess, and if it can, how? What…
FiddlingAway
  • 1,598
  • 3
  • 14
  • 30
0
votes
1 answer

PHP date function to extract a raw timestamp?

I want to convert a human readable date time such as 20210419115522 to 2021-04-19 11:55:22 via PHP. How is it possible?
mercury
  • 189
  • 1
  • 15
0
votes
2 answers

How do I avoid " PHP Strict Standards" if I cannot change the version of my PHP (PHP 5)

Here are some examples to some of the errors. I heard this is a result of old code in new code, but I can't change my PHP version off the native 5.4 version ispmanager uses because I need Apache. Tried switching version but it messes up my site. Any…
0
votes
2 answers

session_status() returns none on reload

I have already seen this identical opposite question and its OP code sample seems perfectly fine to me. I've also read (including PHP docs) that session can be checked with session_status() on PHP >= 5.4 and it should be fine to do so before calling…
Adrián
  • 45
  • 1
  • 3
  • 12
0
votes
1 answer

How to find the Lower and Upper Byte from Hex value in PHP?

I have a series of Hex values like 0x1b12, 0x241B, 0x2E24, 0x392E and I need to calculate the Lower byte and Upper Byte from each of these hex values for further processing. How can I do that? I did a bit of research and saw that there is an unpack…
harry
  • 1,410
  • 3
  • 12
  • 31
0
votes
1 answer

PHP Include_once will include file a second time if a parent directory has a different case

I have a directory structure as follows: test scripts testClasses.php testSubDirectory otherSubDirectory include1.php include2.php includeTest.php Here is the code for each file: testClasses.php:
BluesSax
  • 1
  • 1
0
votes
1 answer

How can this ereg code possibly be updated to preg_match?

I have reviewed the answers to this out the wazoo. I've googled this the same. I have a variable that works really great with php 5.4 ereg but fails miserably with the latest stuff. ereg($user.$pass, preg_replace('/\s/', '', …
user13745692
0
votes
0 answers

php not honoring newline

I am running php 5.4.16 on CentOS7. I am trying to create a multiline file. According to the php syntax I have it correct, but it does not honor the newline. Right now I am going back to basic and just using the example on the php site, and it…
user2236794
  • 441
  • 3
  • 7
  • 22
0
votes
1 answer

What do & symbol and call_user_func_array(array($stmt, "bind_param"), $value) do in php?

I want to do myqsli_stmt_bind_param using call_user_func_array(), because I have dynamically values that should be passed to the query. First, I tried just directly put my $bind_params[] = [$type, $value] (without &) as second parameter of…
0
votes
1 answer

Laravel relationships seems to not working

I have an Item and AdvertItem objects in Laravel. I want to create a 1 to 1 relationship between an item and advert item The item class looks like this
0
votes
2 answers

Unable to send files to thridparty server using php Curl

I have tried below code, since our PHP version is little bit older 5.4.16, so this code is not working with that version, also new CurlFile($_FILES["upfile"]["tmp_name"], $_FILES["upfile"]["type"], $_FILES["upfile"]["name"]), not working with php…
Naveenbos
  • 2,532
  • 3
  • 34
  • 60
0
votes
0 answers

PHP version differs on different folders on same server

I had installed and maintained an application with two different environments, in testing PHP version works fine. but, in clone ( as production ) it looks lower version. tried to set overall account version into PHP 7.1^ but it doesn't work for…
chandru
  • 55
  • 1
  • 8
0
votes
1 answer

Strange DateTime behaviour in date validation in php 5.4

I wrote a simple piece of code to validate the format of a date. The format of the date in my case is d/m/y List of tests that I run successfully 10/12/2019 DATE OK aa/12/2019 DATE KO 10-12-2019 DATE KO But there is this case that surprises…