Wes Mason
<?php $foo = true; // Let's check $foo! if ($foo) { /** * I guess $foo was TRUE! */ echo 'Hello World'; } # Ambiguity? I barely know her. print('Goodbye'); exit(0);
<?php $foo = 'bar'; $baz = $foo; $test = []; define('MY_CONSTANT', 'hello world'); echo MY_CONSTANT;
$ python3 Python 3.4.3 (default, Mar 26 2015, 22:03:40) [GCC 4.9.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> len(dir(__builtins__)) 148
<?php function gen_one_to_three() { for ($i = 1; $i <= 3; $i++) { // Note that $i is preserved between yields. yield $i; } }
Note: Namespaces uses the \ separator, e.g.
<?php namespace 'wesmason'; class Foo { } namespace 'wesmason\bar'; class Baz { }
<?php $foo = new wesmason\Foo; $baz = new wesmason\Bar\Baz();
<?php function __autoload($class_name) { include $class_name . '.php'; } $obj = new MyClass1(); $obj2 = new MyClass2();
<?php function __autoload($name) { $parts = explode($name, '\\'); require $parts[0]; }
<?php $foo = array(1, 2, 'bar'); $baz = [ 'fred' => 42, 'velma' => 50 ]; assert(in_array('velma', $foo) === false); assert(in_array('fred', $baz) === true);
{ "name": "wilgucki/csv", "description": "Laravel 5 package for writing and reading CSV files", "keywords": ["Laravel", "csv"], "license": "MIT", "authors": [ { "name": "Maciej Wilgucki", "email": "mwilgucki+packagist@gmail.com" } ], "require": { "php": ">=5.5.0" }, "autoload": { "psr-4": { "Wilgucki\\Csv\\": "src" } } }
Note: That damned \ again, e.g.
{ "autoload": { "psr-4": {"Acme\\": "src/"} } }
<?php $debug_function = function() { echo xdebug_call_function(); };
$ composer global install "d11wtq/boris" $ export PATH="$PATH:~/.composer/vendor/bin/" ... $ boris
$ boris [1] boris> $test = ['foo', 'bar', 'baz']; // array( // 0 => 'foo', // 1 => 'bar', // 2 => 'baz' // ) [2] boris> foreach($test as $t) { [2] *> echo $t . "\n"; [2] *> } foo bar baz [3] boris> ^D