我不知道这是允许的,直到最近在测试一些东西时我发现它是允许的。我也不知道此功能的文档,所以我现在知道它是如何工作的。如果可以,我应该使用它吗?因为它确实减少了代码的重复。考虑以下示例:
//using this feature
if( is_numeric( $number = array_pop( $array ) ) ) {
//work directly with $number and popped array
}
//not using this feature
if( is_numeric( end( $array ) ) ) {
$number = array_pop( $array );
//had to use an extra statement, plus more processing since what could have been done in just statement had to be done in two
}