Voting

: min(one, nine)?
(Example: nine)

The Note You're Voting On

helvete at zhouba dot cz
8 years ago
It is worth noting, that keyword 'self' can be used for constant retrieval from within the class it is defined

<?php
class Foo {
const
PARAM_BAR = 'baz';

public function
getConst($name) {
return
constant("self::{$name}");
}
}

$foo = new Foo();
echo
$foo->getConst('PARAM_BAR'); // prints 'baz'
?>

<< Back to user notes page

To Top