Questions tagged [php-5.5]

PHP 5.5 is the successor to PHP 5.4. It was released on June 20, 2013. Use this tag for version-specific issues relating to specifically to PHP 5.5.

The key features of PHP 5.5.0 include:

  • Added generators and coroutines.
  • Added the finally keyword.
  • Added a simplified password hashing API.
  • Added support for constant array/string dereferencing.
  • Added scalar class name resolution via ::class.
  • Added support for using empty() on the result of function calls and other expressions.
  • Added support for non-scalar Iterator keys in foreach.
  • Added support for list() constructs in foreach statements.
  • Added the Zend OPcache extension for opcode caching.
  • The GD library has been upgraded to version 2.1 adding new functions and improving existing functionality.
  • A lot more improvements and fixes.

See Migrating from PHP 5.4.x to PHP 5.5.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:
527 questions
312
votes
9 answers

What does yield mean in PHP?

I've recently stumbled over this code: function xrange($min, $max) { for ($i = $min; $i <= $max; $i++) { yield $i; } } I've never seen this yield keyword before. Trying to run the code I get Parse error: syntax error, unexpected…
Gordon
  • 312,688
  • 75
  • 539
  • 559
130
votes
11 answers

Stop caching for PHP 5.5.3 in MAMP

Installed MAMP on a new Macbook with PHP 5.5.3. Reload and refresh do nothing. Still nothing. Google around for a few minutes trying to find out what is wrong, come back and refresh. It works. What the heck? I went into php.ini and disabled all the…
Daron Spence
  • 1,583
  • 3
  • 14
  • 17
50
votes
3 answers

Collisions with other trait methods

How can I deal with traits with methods of same name? trait FooTrait { public function fooMethod() { return 'foo method'; } public function getRow() { return 'foo row'; } } trait TooTrait { public function tooMethod()…
Run
  • 54,938
  • 169
  • 450
  • 748
48
votes
1 answer

Replace deprecated preg_replace /e with preg_replace_callback

$result = preg_replace( "/\{([<>])([a-zA-Z0-9_]*)(\?{0,1})([a-zA-Z0-9_]*)\}(.*)\{\\1\/\\2\}/iseU", "CallFunction('\\1','\\2','\\3','\\4','\\5')", $result ); The above code gives a deprecation warning after upgrading to PHP…
dima.h
  • 860
  • 2
  • 10
  • 14
46
votes
3 answers

Best way to document (phpdoc) generators (methods that yield)

What is the best way to document, for phpdocumentor2, a method that is a generator. I don't think @return really works for yield, but I can't seem to find any proper alternative. Is it just a matter of waiting for phpdoc to catch up?
Mat-Locomotive
  • 811
  • 1
  • 8
  • 6
36
votes
3 answers

Zend OPCache - opcache.enable_cli 1 or 0? What does it do?

In the documentation it says "mostly used for debugging" which would lead me think "never enable it unless you've a problem and need to do some debugging," however reading mostly everything that I could find about it says to enable it…
Jack
  • 653
  • 1
  • 6
  • 14
35
votes
8 answers

How to get MIME type of a file in PHP 5.5?

I am using mime_content_type() in PHP 5.5 to get a MIME type, but it throws fatal: error function not found. How can I achieve this on PHP 5.5?
Jitendra Yadav
  • 896
  • 1
  • 6
  • 14
30
votes
3 answers

How to find out if I have gd library or imagemagick installed?

This might seem a really stupid question. I am new php image processing. I assume there are only two imageprocessing libraries in php. They are called GD/GD2 and Imagemagick. How do I know which I have installed? or if I have installed any? I have…
odbhut.shei.chhele
  • 5,834
  • 16
  • 69
  • 109
22
votes
3 answers

strtotime result makes no sense, php bug?

The following line: echo date('d', strtotime('First Saturday August 2015')); prints 08, which doesn't seem to make any sense because the first occurrence of a day of the week can't be after the 7th. Is it a php bug or a php bug or maybe even a php…
Markus Kottländer
  • 8,228
  • 4
  • 37
  • 61
21
votes
10 answers

PHP array_column - how to keep the keys?

I'm having issues getting the key of $items using array_column. This is the $items array: $items = array( 1 => [ "id" => 5 ], 3 => [ "id" => 6 ], 4 => [ "id" => 7 ], ); …
Run
  • 54,938
  • 169
  • 450
  • 748
14
votes
3 answers

SwiftMailer error Undefined property: Swift_Transport_StreamBuffer::$_sequence

I'm using SwiftMailer to send email by SMTP. The library is working fine when running in the server with PHP version 5.4. However, after upgrading the server to PHP version 5.5, email was not sent and the server threw the following error: Undefined…
Osh Mansor
  • 1,232
  • 2
  • 20
  • 42
13
votes
3 answers

The different behavior of the function uasort in PHP 5.5 and PHP 7.0

I encountered a strange behavior of Magento 1.8 after changing php version from 5.5 to 7.0. This strange behavior is due to a change in the work function uasort. Source code: [ "before" => ["subtotal",…
danil
  • 230
  • 2
  • 10
11
votes
1 answer

Get headers with an underscore on NGINX

I have multiple apps in Google Play and App Store. These send custom request headers but these headers include an underscore e.g api_key. The server has now moved from PHP 5.2 on Apache to PHP 5.5 on nginx. On NGINX, apache_request_headers() and…
Mark
  • 4,428
  • 14
  • 60
  • 116
10
votes
5 answers

How can export mysql data in to xml using php

Below code is for export data from mysql table as xml file. I have tried several code but not getting the result. Please check and help me. Currently getting result…
Sarath TS
  • 2,432
  • 6
  • 32
  • 79
10
votes
1 answer

Ajax Parse Error when returning array from PHP

I have read most of the SA questions regarding this issue, but none have solved my problem. The following code is passing a JavaScript array to PHP5. This works fine, but when I return a PHP array to the ajax code, a parserror: unexpected token "["…
ron tornambe
  • 10,452
  • 7
  • 33
  • 60
1
2 3
35 36