1.自定义函数
<?php
function myfunction($my,$you){
print "MyArgument is :".$my."<br/>";
print "YourArgument is :".$you."<br/>";
}
//调用
myfunction("Mine","Yours");
?>
<?php
function myfunction($my,$you){
print "MyArgument is :".$my."<br/>";
print "YourArgument is :".$you."<br/>";
return $my.$you; //带有返回值
}
//调用
$val = myfunction("Mine","Yours");
print $val;
?>
2.类和对象
<?php
class myclass{
function helloWorld(){
print "Hello World";
}
}
$myobj = new myclass();
$myobj->helloWorld(); //类方法调用使用->
?>