<?php
 #参数按引用传递
 function Test(&$num)
 {
     $num += 200;
 }
 
 $c = 100;
 Test($c);
 echo "<br/>".$c;
 
 #默认参数值
 function GetList($pageIndex = 1){
     printf("<br/>当前获取第%d页的数据",$pageIndex);
 }
 
 GetList();
 GetList(2);
 GetList(3);
 
 #函数返回多个值
 function GetInfos(){
     $info[] = "zhangsan";
     $info[] = "男";
     $info[] = 20;
     return $info;
 }
 
 list($name,$sex,$age) = GetInfos();
 printf("<br/>name:%s,sex:%s,age:%d",$name,$sex,$age);
?>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-27
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
猜你喜欢
  • 2021-09-19
  • 2021-12-09
  • 2021-08-10
  • 2021-07-02
  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案