Michał Pipa
function foo(): array {
return [];
}
<?php
declare(strict_types=1);
function add(int $a, int $b): int {
return $a + $b;
}
var_dump(new class($i) {
public function __construct($i) {
$this->i = $i;
}
});
isset($_GET['user']) ? $_GET['user'] : 'nobody'
$_GET['mykey'] ?: ""
$_GET['user'] ?? 'nobody'
$randomStr = random_bytes($length = 16);
$randomInt = random_int($min = 0, $max = 127);
use Doctrine\Common\Collections\Expr\Comparison;
use Doctrine\Common\Collections\Expr\Value;
use Doctrine\Common\Collections\Expr\CompositeExpression;
use Doctrine\Common\Collections\Expr\{ Comparison, Value, CompositeExpression };
intdiv(int $numerator, int $divisor)
Before: Fatal error: Call to a member function method() on a non-object
After: Fatal error: Uncaught exception 'EngineException' with message 'Call to a member function method() on a non-object'
Online PHP & HHVM shell, execute code in 100+ different versions!