Created
August 9, 2012 01:38
-
-
Save dduan/3300223 to your computer and use it in GitHub Desktop.
Nobody in the right mind would ever invent or use this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// some thing is wrong with github, it keeps posting the snippet twice unless I edit one of them to this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from http://www.php.net/manual/en/language.types.string.php | |
<?php | |
// Show all errors. | |
error_reporting(E_ALL); | |
class beers { | |
const softdrink = 'rootbeer'; | |
public static $ale = 'ipa'; | |
} | |
$rootbeer = 'A & W'; | |
$ipa = 'Alexander Keith\'s'; | |
// This works; outputs: I'd like an A & W | |
echo "I'd like an {${beers::softdrink}}\n"; | |
// This works too; outputs: I'd like an Alexander Keith's | |
echo "I'd like an {${beers::$ale}}\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment