其實(shí)這一節(jié)課主要說到了php關(guān)于函數(shù)的特性——閉包(這是我在JavaScript里面學(xué)習(xí)到的概念,個(gè)人感覺基本一致,大神不喜勿噴,還請指正),一個(gè)php函數(shù)如果沒有調(diào)用函數(shù)本身,該函數(shù)里面的變量、參數(shù)、嵌套函數(shù)等內(nèi)容就無法在全局作用域里面調(diào)用,因?yàn)殚]包特性,所以需要調(diào)用函數(shù)本身,才能調(diào)用函數(shù)里面的內(nèi)容。
2017-09-04
<?php
function abc($sum_arry){
$max_arry = $sum_arry[0];
foreach ($sum_arry as $sum){
if($max_arry<$sum){
$max_arry = $sum;
}
}
return $max_arry;
}
?>
<?php
$abc = array(1,2,3);
echo abc($abc);
?>
function abc($sum_arry){
$max_arry = $sum_arry[0];
foreach ($sum_arry as $sum){
if($max_arry<$sum){
$max_arry = $sum;
}
}
return $max_arry;
}
?>
<?php
$abc = array(1,2,3);
echo abc($abc);
?>
2017-08-24
<?php
function shuzu(){
return array(1,2,3);
}
print_r(shuzu());
?>
function shuzu(){
return array(1,2,3);
}
print_r(shuzu());
?>
2017-08-24
<?php
function abc(){
$sum_arry = array(12,21,23,56,41);
$max_arry = $sum_arry[0];
foreach ($sum_arry as $sum){
if($max_arry<$sum){
$max_arry = $sum;
}
}
echo $max_arry;
}
?>
<?php
abc()
?>
function abc(){
$sum_arry = array(12,21,23,56,41);
$max_arry = $sum_arry[0];
foreach ($sum_arry as $sum){
if($max_arry<$sum){
$max_arry = $sum;
}
}
echo $max_arry;
}
?>
<?php
abc()
?>
2017-08-24
是我聲卡壞了嗎???????????????????
怎么聽不清????????????????????
還是我耳朵壞了?????????????????
還是我電腦喇叭進(jìn)水了?????????????
怎么聽不清????????????????????
還是我耳朵壞了?????????????????
還是我電腦喇叭進(jìn)水了?????????????
2017-08-09
閉包就是能夠讀取其他函數(shù)內(nèi)部變量的函數(shù);匿名函數(shù)是沒有函數(shù)名的函數(shù)。他們的共同點(diǎn)是都是函數(shù),僅此而已。不一樣的
2017-07-17