Skip to content

Instantly share code, notes, and snippets.

@shtrom shtrom/staticVsSelf.php
Last active Mar 25, 2019

Embed
What would you like to do?
`static` vs `self`
<?php
class VarHolder {
const VAR = 2;
public function showVar() {
echo self::VAR;
echo static::VAR;
}
}
<?php
class ChildVarHolder extends test {
const VAR = 4;
public function doSomething() {
echo self::VAR;
echo static::VAR;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.