Yesterday I found some people on my [favorite reddit][lolphp] wonder about the output of the following code:
<?php
$a = 1;
$c = $a + $a++;
<?php | |
spl_autoload_register(function ($name) { | |
// $exp will be the name of the class without the \with\traitname part => array_splice | |
$exp = explode("\\", $name); | |
// serach from end | |
$index = array_search("with", array_reverse($exp, true)); | |
if (!$index || $index - 1 == count($exp)) // also fail when value is 0 | |
return false; |
/* +----------------------------------------------------------------------+ | |
| PHP Version 5 | | |
+----------------------------------------------------------------------+ | |
| Copyright (c) 1997-2013 The PHP Group | | |
+----------------------------------------------------------------------+ | |
| This source file is subject to version 3.01 of the PHP license, | | |
| that is bundled with this package in the file LICENSE, and is | | |
| available through the world-wide-web at the following url: | | |
| http://www.php.net/license/3_01.txt | | |
| If you did not receive a copy of the PHP license and are unable to | |