其实这一节课主要说到了php关于函数的特性——闭包(这是我在JavaScript里面学习到的概念,个人感觉基本一致,大神不喜勿喷,还请指正),一个php函数如果没有调用函数本身,该函数里面的变量、参数、嵌套函数等内容就无法在全局作用域里面调用,因为闭包特性,所以需要调用函数本身,才能调用函数里面的内容。
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
是我声卡坏了吗???????????????????
怎么听不清????????????????????
还是我耳朵坏了?????????????????
还是我电脑喇叭进水了?????????????
怎么听不清????????????????????
还是我耳朵坏了?????????????????
还是我电脑喇叭进水了?????????????
2017-08-09