mischa.samolkaev
Продвинутый
Дата регистрации:
12.07.2012 13:00:02
Сообщений: 74
Тему можно шире брать, ведь пхп позволяет и так
<?php
function test($arg){
print 'I am testing '.$arg;
}
test('program1');//I am testing program1
$name='test';
$name('program2');//I am testing program2
class tester{
public $name;
public function __construct($name){
$this->name=$name
}
public function test($arg=$this->name){
print 'I am testing '.$arg;
}
static public function testS(){
print 'I am testing myself'
}
}
$test=new tester('lala');
print $test->name; //lala
$property='name';
print $test->$property;// lala
$test->test();// I am testing lala
$test->test();// I am testing blabla
$method='test';
$test->$method();// I am testing lala
$test->$method();// I am testing blabla
tester::testS();//I am testing myself
$stMethod='testS';
tester::$stMethod();//I am testing myself
?>