を疑問視だから私は持っている:シンプルなPHPクラスは
class foo {
public $variable_one;
public $variable_two;
function_A(){
// Do something
$variable_one;
$variable_two;
// If I define variable_3 here!
$variable_3
// Would I be able to access it in function_B?
}
function_B(){
// Do something
$variable_4 = $variable_3
}
}
$myObj = new foo();
// Now what do I write in order to assign "variable_one" and "two" some value?
$myObj->$variable_one = 'some_value' ??
$myObj->$variable_two = 'some_value' ??
オブジェクトのパブリック属性にアクセスするための構文は '$ myObj-> variable_one'であり、' $ myObj-> $ variable_one'は '$ variable_one == 'foo''ならば' $ myObj-> foo'です。 – p4bl0
$ myObj-> variable_one = '値を何かに割り当てる'; – localshred