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
1 answer

Is it possible to count the number of opcodes with Tokenizer?

I want to get the total number of opcodes a given (user-defined) function has. For my purpose, I'm not interested in knowing what the specific opcodes are, just how many exist. I know of two PECL extensions that would allow me to get this…
Alix Axel
  • 151,645
  • 95
  • 393
  • 500
0
votes
3 answers

Does the following call to call_user_func_array() work?

I have a couple of libraries that use code similar to the following one. $args = array_merge(array(&$target, $context), $args); $result = call_user_func_array($callback, $args); The code is different in both the cases, but the code I shown is what…
apaderno
  • 28,547
  • 16
  • 75
  • 90
-1
votes
2 answers

Get the number of days between two dates just for the current month

I have to calculate the number of days that have passed between two dates, but I need to split the days difference per month and just display the current month passed days. This is needed to calculate vacations time for an employee. Note: I need to…
-1
votes
1 answer

Request Value always getting null in PHP 5.4 API

In below code, value not meet when its calling using Ajax. $pos always return null value
-1
votes
2 answers

Is there some Error class replacement for PHP 5.4?

I like to use the PHP Error class to return using throw like this: throw new Error('Some problem description'); Sadly, I have to use PHP 5.4.16 on CentOS 7.5. The Error class was introduced in PHP 7. Is there a class that I can include which…
Volker
  • 428
  • 4
  • 15
-1
votes
2 answers

How to SELECT data from Oracle using PHP

Im using ORACLE to select the user that Lock a table, the query works fine, but when I try to retrieve the results, thrown me an error. $c = ' SELECT oracle_username os_user_name, locked_mode, object_name, object_type FROM V$LOCKED_OBJECT…
Leoh
  • 642
  • 2
  • 17
  • 41
-1
votes
1 answer

Check if key value pair exists in the least amount of operations an array in PHP 5.4

I want to check that the key - value pair 'purpose' => 'toggle' is not in an array of options for an element with the type checkbox. It is possible that there is only the key 'purpose', only the value 'toggle', both as a pair, both not as a pair or…
-1
votes
2 answers

How are include_once loops handled in php?

I have 3 different…
xRahul
  • 364
  • 5
  • 18
-1
votes
1 answer

Get the wrong date in php with a virtual machine

I installed a virtual machine with php, mysql, apache2. Now when I write in the terminal : date I get : Thu Dec 06:55:25 EET 2016. When I try to get the now date in php, I write : error_log(print_r(new \DateTime('now'),true), 3,…
Harea Costicla
  • 797
  • 3
  • 9
  • 20
-1
votes
1 answer

Fatal error: Call to a member function bind_param() on a non-object in C:\wamp\www\k24Electronics\admin\Supplier\import.php on line 13 Call Stack

function add_product( $product_name, $product_brand, $product_type, $product_description,$product_price, $number, $reservefee, $status,$image,$supplier_id ) { global $data,$sth; $con = new…
Murithi H
  • 11
  • 1
-1
votes
1 answer

PHP5.4 code Runs on server but not on local

I got a php code (index.php) from a friend, something like this:
  • Kokizzu
    • 24,974
    • 37
    • 137
    • 233
  • -1
    votes
    1 answer

    Best Way convert PHP5.4 Array Dereferences To Be PHP5.3 Compatible

    Issue Need to convert an Array Deference that works in PHP 5.4 to a version that works with PHP 5.3. I'm unable to update my live site PHP so I'm a bit stuck. What I'm trying to accomplish is create a coupon code for Drupal 7 as a form is…
    CJdriver
    • 458
    • 7
    • 20
    -1
    votes
    1 answer

    Syntax error or access violation: 1064 Erreur de syntaxe

    When trying to run this code in Zend 2 with doctrine 2 with this Script : $query = $entityManager->createQuery('SELECT u FROM \Synchro\Entity\Group u WHERE u.namegroup=:namegroup'); $query->setParameters(array( …
    mari roza
    • 27
    • 2
    • 7
    -1
    votes
    1 answer

    how to check if a multidimensional session array is set in php?

    In my code i have used the following code to create a multidimensional session array , which i use to store certain details . now i need to check if the sessionis set for certain id , while i run the same function again. i have set a session array…
    rranj
    • 288
    • 1
    • 5
    • 16
    -1
    votes
    1 answer

    var_dump has unreadable output

    I have a method to dump a var_dump output to a file, as such: function dumpToFile($object) { $file = "c:/tmp/php.log"; ob_start(); var_dump($object); $output = ob_get_clean(); $fh = fopen($file, "a+"); fwrite($fh,…
    Francis Ducharme
    • 4,848
    • 6
    • 43
    • 81