J'ai donc:classes PHP question simple
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' ??
la syntaxe pour accéder aux attributs publics d'un objet est '$ myObj-> variable_one', et' $ myObj -> $ variable_one' est '$ myObj-> foo' si' $ variable_one == 'foo''. – p4bl0
$ myObj-> variable_one = 'affecter la valeur à quelque chose'; – localshred