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
9
votes
2 answers

How can I migrate Zend Framework 1 to 3

Has anyone please describe how much architecture changed by Zend from Ver 1 to 3. Recently zend released ZF3 but no information provide how to migrate from zf1 to zf3. I have an application was developed in zf1, now looking for upgrade it to using…
Dheeraj
  • 109
  • 1
  • 1
  • 4
9
votes
4 answers

Unable to connect to SQL Server with PHP

Connection to sqlsrv string not working. $login = new PDO("sqlsrv:server=MYSQLSERVER\SQLEXPRESS;Database=db_name", "user", "passw"); And i have error message: Fatal error: Invalid handle returned. I'm 101% sure that login details is OK. Because it…
Klapsius
  • 3,273
  • 6
  • 33
  • 56
9
votes
4 answers

Unable to load dynamic library php_sqlsrv_7_nts.dll is not a valid Win32 application

Thought I'd see if there were any sql server drivers for php 7. Another question on Stack Overflow pointed me to these drivers here So I install php_sqlsrv_7_nts.dll into my ext folder and add the following line to my…
Graham
  • 7,807
  • 20
  • 69
  • 114
9
votes
1 answer

Installing mailparse php7 mbstring error

I'm currently working to put our project under php7. When trying to compile the mailparse extension or use pecl to install it, I get this error: #error The mailparse extension requires the mbstring extension! I did install the php7.0-mbstring and…
9
votes
3 answers

PHP7 / MemCache Deprecated Error Message

I have just updated to PHP7 via Homebrew. I now get the following error message when doing a php -v: PHP Deprecated: PHP Startup: memcached.sess_lock_wait and memcached.sess_lock_max_wait are deprecated. Please update your configuration to use…
hawx
  • 1,629
  • 5
  • 21
  • 37
9
votes
3 answers

How exactly php spaceship operator compare strings, arrays and objects

I am wondering how the php spaceship operator compares strings, objects and arrays. For example, the below code. echo "Its Me at SO" <=> "Its Me at SO"; will return 0, as i know all characters are same, count is same. But if i have a code like…
Altaf Hussain
  • 5,166
  • 4
  • 30
  • 47
9
votes
4 answers

Using PHP 7 with WAMP

My OS is Windows 10 Pro x64 and I have installed VC14 packages x86 and x64. I have added a php7.0.0 directory to wamp/bin/php, copied files php.ini, phpForApache.ini and wampserver.conf, and modified the directories and php extensions in these…
tyd01
  • 161
  • 1
  • 1
  • 10
9
votes
3 answers

php 7 unable to initialize sqlsrv

I searched all day to find out a solution for sqlsrv dll on php 7 VC14 x64 Thread Safe and i did not found a solution. Does anyone solved this issue : [04-Oct-2015 19:48:05 UTC] PHP Warning: PHP Startup: pdo_sqlsrv: Unable to initialize…
Pierre-Luc Bolduc
  • 485
  • 1
  • 5
  • 18
9
votes
2 answers

Blank page if I declare(strict_types=1); in PHP 7 at top of the file

Recently I was checking out on PHP 7, specifically return type declaration and type hinting. I have compiled PHP 7 from source(master branch from Github) and running it in Ubuntu 14.04 virtual box. I tried to run following code to get a test of new…
pinkal vansia
  • 10,240
  • 5
  • 49
  • 62
9
votes
1 answer

PHP 7 Fatal error: static::class cannot be used for compile-time class name resolution

Current Travis-CI PHP7 builds throw the following error when executing the following code: PHP 7 Fatal error: static::class cannot be used for compile-time class name resolution trait EloquentValidatingTrait { // Some declarations skipped /** …
Vladislav Rastrusny
  • 29,378
  • 23
  • 95
  • 156
8
votes
3 answers

How to hide only sensitive arguments in PHP's debug_backtrace?

This question was asked in June 2021, long before the release of PHP 8.2 (Dec 2022). For PHP 8.2+ see Josh's answer. For PHP <8.2, no answer solves the question (including my own). The code I posted in my answer is the closest to a solution that…
reformed
  • 4,505
  • 11
  • 62
  • 88
8
votes
4 answers

Laravel custom validation rule refering to other request params

I'm trying to create a custom validation rule that accept a parameter, but this parameter is the name of another field in the request, like for the required_with rule. I easily can handle given params in my rule, but i'm struggling to find out how…
fudo
  • 2,254
  • 4
  • 22
  • 44
8
votes
6 answers

PHP7 Adding a slash to all standard php functions php-cs-fixer rule

Inherited a PHP7 project. The previous developer added a slash to all standard PHP functions even for \true. Is there any reason for doing this? Some examples: \array_push($tags, 'master'); if ($result === \true) {} $year = \date('Y'); What is…
Yada
  • 30,349
  • 24
  • 103
  • 144
8
votes
1 answer

Library failure when installing Libsodium (Amazon EC2)

I can't figure out how to get Libsodium up and running on my EC2 instance. When attempting to check if the installation was successful with: php7 --info | grep sodium I get the following warning: PHP Warning: PHP Startup: Invalid library (maybe…
Fyntasia
  • 1,133
  • 6
  • 19
8
votes
2 answers

Why use dynamic variables (variable variables) in PHP or other languages

I was just recently introduced to the concept of dynamic variables in PHP. To me it seems like using dynamic variables in a program would make it difficult to read/follow. Can anyone explain to me the benefits and/or share a real simple real world…
ScottyG
  • 3,204
  • 3
  • 32
  • 42