How to find John Smith?
???
<?
/*
* This is a test of Class and there uses
* Thanks for the NuSphere PHPed
*
*/
// A Town of Usa
class town{
// A building, with 3rd floor
function f_building1($id){
switch($id){
case 1:
echo "Karnel Smith, eating <br>";
return 0;
break;
case 2:
echo "Peter Smith, showering <br>";
return 0;
break;
case 3:
echo "John Smith, hacking.. <br>";
return "John Smith";
break;
}
}
// A building, with 2 floor
function f_building2($id){
switch($id){
case 1:
echo "Bush Smith, reading reports <br>";
return 0;
break;
case 2:
echo "Jack Smith, no job.. smoking.. <br>";
return 0;
break;
}
}
}
// Police inquery, from car
$pol = new town();
// Searching all building, Find John Smith!! programmer...
$searching = "John Smith";
for($i=0;$i<10;$i++){
$moving = $pol->f_building1($i);
if ( $moving==$searching ) {
echo "Sir, we found him, arrest him. <br>";
}else if($pol->f_building2($i)==$searching ){
echo "Sir, we found him, arrest him. <br>";
}
}
?>