i got some trouble to understand scope in OOP. What i want is that $foo->test_item() prints “teststring”…Now it just fails with:
Warning: Missing argument 1 for testing::test_item()
Thanks a lot!
<?php
class testing {
public $vari = "teststring";
function test_item($vari){ //$this->vari doesn't work either
print $vari;
}
}
$foo = new testing();
$foo->test_item();
?>
test_item()should be:There is no need to pass
$varias a parameter.