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
22
votes
11 answers

Laravel with App Engine Standard Class 'Facade\Ignition\IgnitionServiceProvider' not found

This is driving me crazy second day. I'm new to Laravel and trying to get Laravel 6 work on Google App Engine Standard. Tried: This tutorial and other ones, but it still fails to load Laravel index page What I have done: Created new Laravel…
ProgZi
  • 1,028
  • 3
  • 14
  • 25
20
votes
1 answer

PHP return type hinting, object OR a boolean?

So I know that I can do return type hinting in php7. I can do an object return hint with: function getUser($pdo, $username) : User { } where User is the object being returned. However, if the user isn't found in the SQL, returning 'false' instead…
life
  • 221
  • 1
  • 2
  • 7
20
votes
1 answer

php 7 Mcrypt PHP extension required

hello guys l have installed php7 from this link and this link too. but when i try to run a Laravel based project there is an error coming up as follows Mcrypt PHP extension required. I tried to locate mcrypt.so and change the path in mycrpt.ini…
Ali Bedaer
  • 395
  • 1
  • 4
  • 12
20
votes
2 answers

Returning NULL with return type declarations

I was refactoring a codebase for use with PHP7, particularly implementing scalar type hints and return type hints, when I encountered an problem. I have a class with some properties, one of which an id. This id is not mandatory (you can construct an…
Compizfox
  • 748
  • 2
  • 7
  • 17
19
votes
6 answers

Make phpunit catch php7 TypeError

I am trying to validate that a php7 function accept only integers. This is the class: id = $id; } } And this is the…
michaelbn
  • 7,393
  • 3
  • 33
  • 46
18
votes
1 answer

PHP array_column() not returning object falsy values

I'm sure this is expected behavior for array_column(): class myObj { public $prop; public function __construct(int $prop) { $this->prop = $prop; } } $objects = [ new myObj(7), new myObj(3), new myObj(8), new…
Stephen Last
  • 5,491
  • 9
  • 44
  • 85
18
votes
3 answers

What´s up with multithreading in php 7

I have read that one of expected features of PHP 7 is native Multithreading (http://www.phpzag.com/php-7-expected-features-for-php-7/) but now it is not listed in list of features http://php.net/manual/en/migration70.new-features.php Do you know if…
Michal Mäsiar
  • 280
  • 1
  • 3
  • 9
18
votes
4 answers

PHP7 + Symfony 2.8, Failed to write session data

i compiled php7 on my own (974f6c2a705). if i run php7 + php-fpm + nginx using symfony i get this error: (using the snc redis bundle for sessions:) Warning: session_write_close(): Failed to write session data (user). Please verify that the current…
timg
  • 501
  • 2
  • 4
  • 13
17
votes
1 answer

What type hint to use if return value is mixed?

function foo ($a): mixed { if ($a == 1) return true; else return 'foo'; } var_dump(foo(1)); Since mixed is not a real type this results to: Fatal error: Uncaught TypeError: Return value of foo() must be an instance…
IMB
  • 15,163
  • 19
  • 82
  • 140
17
votes
2 answers

PHP7.0-fpm extremly slow on Ubuntu Windows Subsystem Linux

I installed Windows Subsystem Ubuntu shell recently and shifted all of my development from XAMPP to nginx and php7.0-fpm installed through ubuntu windows subsystem. The problem i am facing is that php files load extremly slower. For a test I simply…
S. A. Malik
  • 3,465
  • 6
  • 37
  • 56
17
votes
8 answers

Enable cURL on PHP7 windows10 64 bit Apache 2.4

I am using Windows10 64 bit Apache 2.4.25 (Win64) PHP 7.1.0-Win32-VC14-x64 when i try calling curl_init() function, i get an error saying "Call to undefined function curl_init()" tried following copying ssleay32.dll & libeay32.dll & php7ts.dll to…
Sonic
  • 183
  • 1
  • 1
  • 7
17
votes
8 answers

Windows, XAMPP, PHP 7 and opcache

I've installed latest XAMPP server with PHP 7 (update: checked also PHP 7.1) (on my Windows 10 system). Wanted to use opcache, so I enabled it in php.ini.…
Jazi
  • 6,569
  • 13
  • 60
  • 92
17
votes
1 answer

PHP 5 to 7 migration - Numbers comparison

I noticed that code below results in different messages in PHP 5.x and 7: if ('0xFF' == 255) { echo 'Equal'; } else { echo 'Not equal'; } 5.x: Equal 7: Not equal Tried to find a description of the changes that cause it in migration guide…
Pavel
  • 3,967
  • 2
  • 29
  • 35
17
votes
2 answers

PHP7 method_exists Uncaught Error: Function name must be a string

I am getting this error: Fatal error: Uncaught Error: Function name must be a string in For this code: if (function_exists($item['function'])) { $item['function']($item, $default); } elseif (method_exists($this, $item['function'])) { …
backups
  • 517
  • 1
  • 6
  • 7
16
votes
4 answers

PHP Fatal error: Class 'PHPUnit\Framework\TestCase' not found with PHPUnit 6 and PHP 7.0

I am playing with php 7 and phpunit 6. Here is the test I wrote:
romaind
  • 461
  • 1
  • 3
  • 10