- strpos: documentation ( source)
<?php
class foo {
function __get($prop) {
echo 'Base: ' . $prop . "\n";
}
}
class bar extends foo {
function __get($prop) {
if (strpos($prop, '_') === false) {
parent::__get($prop);
} else {
echo 'Underscore: ' . $prop . "\n";
}
}
}
$b = new bar;
$b->test;
$b->_test;