Defining php5.5 by rasmus lerdorf
PHP5.5
perforance Inmprovement:
- nested calls
- call stack pre-allocated by compiler
- bundled opcode cache
Generators:
<?php
function xrange($start,$end) {
for ($i=$start;$i <= $send;$i++) {
yield $i;
}
foreach (xrange(0,5) as $i) {
echo $i,"\n";
}
function xrange($start,$end) {
for ($i=$start;$i <= $send;$i++) {
yield $i;
}
foreach (xrange(0,5) as $i) {
echo $i,"\n";
}
finally:
<?php
$db=mysqli_connect();
try{
call_some_function($db);
}finally{
mysqli_close($db);
}
list() in foreach
$names =[["john","smith"],["fred","johnson"]];
foreach($names as list($first,$last)){
echo $first,$last;
}
$db=mysqli_connect();
try{
call_some_function($db);
}finally{
mysqli_close($db);
}
list() in foreach
$names =[["john","smith"],["fred","johnson"]];
foreach($names as list($first,$last)){
echo $first,$last;
}
Const array/string Dereferncing:
echo array(1,2,3)[0];//output 1
echo "foobar"[3];//output b
echo[1,3,4][2];//output 4
echo "foobar"[3];//output b
echo[1,3,4][2];//output 4
- empty() support for functions/expressions
- curl upload functionality rewritten
- simplified password hashing API
Comments
Post a Comment