Skip to content

Instantly share code, notes, and snippets.

@dduan
Created August 9, 2012 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dduan/3300223 to your computer and use it in GitHub Desktop.
Save dduan/3300223 to your computer and use it in GitHub Desktop.
Nobody in the right mind would ever invent or use this.
// some thing is wrong with github, it keeps posting the snippet twice unless I edit one of them to this
// 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