返回值 返回值
function numbers() {
? ?return array(1, 2, 3);
}
list ($one, $two, $three) = numbers();
//將函數(shù)返回的值賦值給了list($one, $two, $three)? list和后面括號內(nèi)的是什么意思?
function numbers() {
? ?return array(1, 2, 3);
}
list ($one, $two, $three) = numbers();
//將函數(shù)返回的值賦值給了list($one, $two, $three)? list和后面括號內(nèi)的是什么意思?
2016-03-09
舉報
2016-03-11
函數(shù)不能返回多個值,但可以通過返回一個數(shù)組來得到類似的效果。
list()只是舉個例子而已,重點是函數(shù)函數(shù)不能返回多個值。
2016-03-09
是將這個數(shù)組內(nèi)3個值返回給3個變量$one, $two, $three嗎?