Introducing-PHP5.4 发表于 2015-11-24 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849$str = 'php,5.4';$arr = explode(',', $str)[1]; //echo phpfunction dosomething(){ return [ 'hello' => 'hello world' ];}/** * 支持短语法 <?= 'xx'?> 相当于<?php echo 'xxx'?> */dosomething()['hello'];//echo hello world/** * 更加准确的处理时间 *///<5.4$startTime = microtime(1);//代码块echo '花费了'.(microtime(1)-$startTime);//>5.4echo '花费了'.(microtime(1)-$_SERVER["REQUEST_TIME_FLOAT"]);/** * TRAIT 实现继承/重复利用 */trait name { public function name($name){ return $name; }}trait age{ public function age($age){ return $age; }}class people{ use name; use age; public function peopleInfo(){ return 'this people name is '.$this->name('hello').'age'.$this->age(19); }}$obj = new people();var_dump($obj->peopleInfo());