Variable type conversion problems with php7.0 and php7.2?

< H2 > Code 001 version 7.0 < / H2 >
<?php
$a="";
$a["1"]="";
$a["0"]="zzz";
var_dump($a);
echo "PHP:".phpversion();
?>
< H2 > results 001 version 7.0 < / H2 >
array(2) {
  [1]=>
  string(9) ""
  [0]=>
  string(3) "zzz"
}
PHP:7.0.0-dev
< H2 > Code 002 5.6 version < / H2 >
<?php
$a="";
$a["1"]="";
$a["0"]="zzz";
var_dump($a);
echo "PHP:".phpversion();
?>
< H2 > results 002 5.6 < / H2 >
array(2) {
  [1]=>
  string(9) ""
  [0]=>
  string(3) "zzz"
}
PHP:5.6.9-0+deb8u1
< H2 > Code 003 7.2 version < / H2 >
<?php

echo PHP_VERSION;

try {
    $a = "";
    // $a->a();
    $a["1"] = "";
    $a["0"] = "zzz";
    var_dump($a);
} catch (Exception $e) {

    var_dump($e->getMessage());

} catch (Error $Error) {

    var_dump($Error->getMessage());
    return;
} catch (ParseError $e) {
    echo 123;
    var_dump($Error->getMessage());
} finally {
    echo "end";

}
< H2 > 7.2.3 results < / H2 >
7.2.3string(2) "z" end
< H2 > question < / H2 >

7.2 Why is this type conversion not supported internally, and where can I see the specific changes? Kernel code is also fine. .

< H2 > Test address: < / H2 >

online execution of php multiple versions

Php
Mar.22,2021

read more documents

clipboard.png


you can see more detailed changes by adding debug_zval_dump ($a) after the code.

$a[] = "hello world";
var_dump($a); // array(1) { [0]=> string(11) "hello world" } 
$a = "";
var_dump($a); // string(0) ""
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37620-34457.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37620-34457.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?