<?php class Expressions { function foo() { // Examples based on php-parser expression types static $array = [1, 2, 3], $arrayDimFetch = [1,2][0], $arrayItem = ['a' => 1], $binaryBitwiseAnd = 1 & 2, $binaryConcat = "a" . "b", $binaryIdentical = 1 === 1, $binaryPlus = 1 + 2, $binarySpaceship = 1 <=> 2, $bitwiseNot = ~1, $booleanAnd = 1 && 2, $booleanNot = !false, $classConstFetch = self::class, $coalesce = 1 ?? 2, $constFetch = PHP_EOL, $new = new stdClass(), $scalarFloat = 3.14, $scalarInteger = 123, $scalarMagicConst = __LINE__, $scalarString = 'string', $ternary = true ? 1 : 2, $unaryPlus = +1; } } $expr = new Expressions(); $expr->foo();
You have javascript disabled. You will not be able to edit any code.