1)The removal of ASP tags (<%
) and script tags (<script language=php>
) as a means of entering or leaving PHP mode. (https://wiki.php.net/rfc/remove_alternative_php_tags)
<%
opening tag<%=
opening tag with echo%>
closing tag(<script\s+language\s*=\s*(php|"php"|'php')\s*>)i
opening tag(</script>)i
closing tag// Integers echo 1 <=> 1; // 0 echo 1 <=> 2; // -1 echo 2 <=> 1; // 16) Null Coalesce Operator (https://wiki.php.net/rfc/isset_ternary) The coalesce, or ??, operator is added, which returns the result of its first operand if it exists and is not NULL, or else its second operand. This means the $_GET['mykey'] ?? "" is completely safe and will not raise an E_NOTICE. Some examples of its use:
$username = $_GET['user'] ?? 'nobody'; // equivalent to: $username = isset($_GET['user']) ? $_GET['user'] : 'nobody';7) Anonymous Classes (https://wiki.php.net/rfc/anonymous_classes) An anonymous class is a class without a (programmer declared) name. The functionality of the object is no different from that of an object of a named class. They use the existing class syntax, with the name missing:
/* return an anonymous implementation of a Page for your MVC framework */ return new class($controller) implements Page { public function __construct($controller) { /* ... */ } /* ... */ };8) Scalar Type Declarations (https://wiki.php.net/rfc/scalar_type_hints_v5) No new reserved words are added. The names int, float, string and bool are recognised and allowed as type declarations, and prohibited from use as class/interface/trait names (including with use and class_alias).
function add(int $a, int $b) { return $a + $b; } if(add(5.5, 5) === 10) { echo "Next step !"; }9) Return Type Declarations (https://wiki.php.net/rfc/return_types) An optional return type declaration to function declarations including closures, functions, generators, and methods.Code which does not declare a return type will continue to work exactly as it currently does.
// Int is not a valid type declaration function answer(): int { return 42; } answer();Some usefulll links which will tell you more about PHP 7 1) https://wiki.php.net/rfc 2) http://php7-tutorial.com/#1 [si-contact-form form='1']