Questions tagged [php-7]

PHP 7 is the successor to PHP 5.6, it was released on December 3, 2015. Use this tag for issues relating to development using PHP 7

PHP 7 is the next version of . It succeeds , which is the last release of the PHP 5.X version. PHP 7.0.0 was released on Dec 3, 2015

PHP 6

Several years ago there was a major push to make PHP Unicode compatible and this push focused around what was then slated to be PHP 6. An internal version was developed and a lot of material was published (including some books) about this new version. Serious problems with the implementation arose, however, and the project was abandoned, with most of the surviving code being implemented in PHP 5.4. To avoid confusion with this discussion the decision was made to skip version 6.

Development

You can download the PHP 7 source and compile it yourself. Official builds are available on the PHP website.

Features

New features of PHP 7 include (See all accepted features):

PHP7 migration guide

There's a whole section on Migrating from PHP 5.6.x to PHP 7.0.x in the manual:

© 1997-2015, The PHP Documentation group, CC-BY 3.0

Information

  • For global question on PHP, please use the generic tag:
  • If you want to talk about PHP or if you have a question, you can come to the PHP chat room
2761 questions
15
votes
4 answers

Return type "self" in abstract PHP class

Trying to make an abstract class to partially implement functionality of its' child classes and force a contract upon them required for this implementation, I use the following construct: abstract class Parent { public static function…
Simon
  • 1,172
  • 12
  • 21
15
votes
4 answers

"Empty delimiter" Warning when using PHP explode() function

In javascript, var myStringToArray = myString.split(''); is perfectly acceptable. But in PHP, $My_String_To_Array = explode('', $My_String); throws an error: Warning: explode() Empty delimiter The PHP manual…
Rounin
  • 27,134
  • 9
  • 83
  • 108
15
votes
8 answers

php-fpm doesn't create .sock file

I have an AWS server running on Amazon Linux. I used this guide to install php7 (bottom of the page): https://forums.aws.amazon.com/thread.jspa?messageID=695576 I would like to use nginx instead of Apache, so I've also installed the php70w-fpm and…
Kezaia
  • 419
  • 1
  • 3
  • 10
15
votes
2 answers

PHP7 compatibility with Symfony3?

With the release of both PHP7 and Symfony3 this week, have Symfony3 been developed with PHP7 in mind? To put it another way, if we have PHP7 installed and are starting a new Symfony3 project from scratch, do we run the risk of facing migration…
Bendy
  • 3,506
  • 6
  • 40
  • 71
14
votes
4 answers

Unable to load dynamic php_mbstring.dll library

I am checking for my php version using php -v command in console and I am getting a WARNING below PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_mbstring.dll' - /usr/lib/php/20151012/php_mbstring.dll:…
jaahvicky
  • 438
  • 2
  • 8
  • 20
14
votes
2 answers

Symfony 2. Migration project to php 7 from php5.5. Performance issues

I have one project ~4y old, I started with 5.3 and Symfony 2.0, migrated to 5.5 and S2.3. At the moment I migrated to S2.8 and I want to migrate to php 7. As there was so much heap around PHP 7 performance I was eager to test my project performance…
Jevgeni Smirnov
  • 3,787
  • 5
  • 33
  • 50
14
votes
1 answer

Which version of Zend Framework 1 is compatible with PHP7?

After which version Zend Framework become compatible with PHP7?
Anıl Özselgin
  • 420
  • 1
  • 4
  • 9
14
votes
5 answers

PHPDocumentor 2 and PHP 7 with opcache issues in Doctrine

Hopefully someone here knows a thing or 2 about this. Short Question I am running into an error using phpdoc on the command line, installed via pear on PHP 7.0.2. The error is: #> phpdoc PHP Fatal error: Uncaught…
Paul Carlton
  • 2,785
  • 2
  • 24
  • 42
13
votes
4 answers

Anonymous class construction

I need an idea to create anonymous class on PHP. I don't know how I can works. See my limitations: On PHP you can't make anonymous class, like anonymous function (like class {}); On PHP you don't have class scope (except in namespaces, but it have…
David Rodrigues
  • 12,041
  • 16
  • 62
  • 90
13
votes
1 answer

Why is $_SESSION passed by reference in PHP 7?

I am upgrading from PHP 5.6 to PHP 7 and a strange problem occurred. 1 ) PHP…
13
votes
1 answer

Does PHP7's PDO ext read the entire result set into memory?

I have noticed since I upgraded to PHP7 that some SQL statements no longer work and instead run out of memory. I have this code: $query = Yii::$app->db->createCommand('select * from tbl_title')->query(); while ($row = $reader->read()) { …
Sammaye
  • 43,242
  • 7
  • 104
  • 146
13
votes
2 answers

Symfony3 Form component trying to pass null to a type hinted method in PHP 7

In my entity class I have defined all the expected argument types for the setters and return types of the getters. Later, when I have a form which uses the said class, I get an error if some of the fields in the form is empty because the form…
Angelov
  • 168
  • 1
  • 8
13
votes
1 answer

Null coalesce operator with casting

I have upgraded to PHP 7 and started using the null coalesce operator to convert things like $email = isset($_SESSION['email']) ? $_SESSION['email'] : ''; to $email = $_SESSION['email'] ?? ''; but I can't figure out how to do this if I am casting…
wogsland
  • 9,106
  • 19
  • 57
  • 93
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
12
votes
2 answers

What's a good example for making use of an anonymous class in PHP7

As I looked for the new PHP7-features I stumbled upon anonymous classes. I didn't understand when they should become useful, and looked for an example. I read this article, but I don't see the benefits of this feature. In the last section before the…