Created
January 15, 2011 19:53
-
-
Save eberfreitas/781189 to your computer and use it in GitHub Desktop.
proposed syntax
This file contains 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
class Bar extends AwesomeClass { | |
const FOO = 'Foo'; | |
public $bar = 'Bar'; | |
protected $var = 'Var'; | |
private $secret = 'Secret'; | |
public function init() { | |
$this->myFunction('Foo'); | |
echo(self::FOO); | |
} | |
public function myFunction($arg) { | |
doSomething(); | |
} | |
public function string() { | |
$string = 'Hello World '; | |
$trimmed = trim($string); | |
} | |
protected function globals() { | |
print($_GET['query']); | |
print($_POST['data']); | |
print($_REQUEST['something']); | |
print($_SESSION['user']); | |
} | |
public function dataTypes() { | |
$string = 'string'; | |
$array = array('item', 'anotherItem'); | |
$dict = array('key' => 'value', 'another key' => 'another value'); | |
$dict['newKey'] = 'some other value'; | |
$dict['some other key'] = 'testing'; | |
} | |
public function shortCuts() { | |
$___TMP___ = explode('Foo|Bar|Foo|Bar'); | |
$foo = $___TMP___['1']; | |
print($foo); | |
} | |
public function regularPhp() { | |
$variable = 'Something'; | |
} | |
} |
This file contains 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
class Bar extends AwesomeClass | |
const FOO = 'Foo' | |
bar = 'Bar' //without the visibility indicator, it defaults to public | |
protected var = 'Var' | |
private secret = 'Secret' | |
//but if you want, you can declare public | |
public func init() | |
this.myFunction('Foo') | |
echo(self::FOO) | |
func myFunction(arg) | |
doSomething() | |
private func string() | |
string = 'Hello World ' | |
trimmed = string.trim() | |
protected func globals() | |
print(_GET.query) | |
print(_POST.data) | |
print(_REQUEST.something) | |
print(_SESSION.user) | |
func dataTypes() | |
string = 'string' | |
//arrays can't have custom keys | |
array = ['item', 'anotherItem'] | |
//this would be a stdObj or an array | |
dict = {key: 'value', 'another key': 'another value'} | |
dict.newKey = 'some other value' | |
dict.'some other key' = 'testing' | |
func shortCuts() | |
foo = 'Foo|Bar|Foo|Bar'.explode('|')[1] | |
print(foo) //outputs 'Bar' | |
func regularPhp() | |
<<< | |
$variable = 'Something'; | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I see your point. Maybe I just like Ruby too much :D .
Good luck — really looking forward to seeing where you take this.