関数、クラス、オブジェクト
949 ワード
1.カスタム関数
2.クラスとオブジェクト
<?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(); // ->
?>