Skip to content

Instantly share code, notes, and snippets.

@DQNEO
Last active January 15, 2016 05:17
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 DQNEO/54ce889746a0a7dfd0fe to your computer and use it in GitHub Desktop.
Save DQNEO/54ce889746a0a7dfd0fe to your computer and use it in GitHub Desktop.
We can use keywords as method names, on PHP7
<?php
<?php
class MyClass
{
public function list()
{
echo "list\n";
}
public function echo()
{
echo "echo\n";
}
}
echo PHP_VERSION . PHP_EOL;
$obj = new MyClass;
$obj->list();
$obj->echo();
@DQNEO
Copy link
Author

DQNEO commented Jan 14, 2016

PHP 7.0.2 (cli) (built: Jan 6 2016 14:39:28) ( NTS )

result

list
echo

PHP 5.6.16 (cli) (built: Nov 26 2015 08:01:30)

result

PHP Parse error:  syntax error, unexpected 'list' (T_LIST), expecting identifier (T_STRING) in /vagrant/a.php on line 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment