From 6572971c25635765c65dc1446f798e7d09097c2d Mon Sep 17 00:00:00 2001 From: Tim Bernhard Date: Sun, 1 May 2022 14:23:20 +0200 Subject: [PATCH 1/3] Use prettier to enforce a consistent style for future contributors --- .prettierignore | 6 + .prettierrc.json | 1 + README.md | 39 +- features.js | 1154 +++++++++++++++++++++----------------------- index.html | 429 +++++++++------- package-lock.json | 813 ++++++++++++++++++++++++++++++- package.json | 4 +- src/style.css | 10 +- tailwind.config.js | 10 +- versions.js | 96 ++-- 10 files changed, 1711 insertions(+), 851 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc.json diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..c9b5e31 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +# Ignore artifacts: +build +coverage +dist +node_modules +images diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1 @@ +{} diff --git a/README.md b/README.md index eb8e02d..227f321 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,10 @@ and more will be added over time. I would love you to pull-request any missing or incorrect data. It's built with: - - [AlpineJS](https://alpinejs.dev) - - [TailwindCSS](https://tailwindcss.com) - - (Ironically) ZERO PHP was used. + +- [AlpineJS](https://alpinejs.dev) +- [TailwindCSS](https://tailwindcss.com) +- (Ironically) ZERO PHP was used. ## Setup and build @@ -26,13 +27,13 @@ If you want to contribute there is a very simple build process that will hopeful Start by: -* Cloning the repository -* Running `npm install` +- Cloning the repository +- Running `npm install` Then to build the CSS using Tailwind you can either: -* `./build.sh` for a one off build or -* `./watch.sh` to run a file watcher +- `./build.sh` for a one off build or +- `./watch.sh` to run a file watcher There is no hot reloading or anything like that. @@ -51,21 +52,21 @@ I am manually curating the list of features and related content here. And I'd lo Feautures to add to the list will need to meet the following criteria: -* They were added, deprecated or removed in PHP version 5.6 or greater. +- They were added, deprecated or removed in PHP version 5.6 or greater. PHP features are listed in `features.js`. Hopefully the format of this makes sense. But for reference -* the whole thing is a JSON array -* each entry is an object with the following properties: - * `name`: The name of the feature - plain text only - * `description`: A description of the feature - HTML is allowed, but may not be styled. `` tags are fine. - * `keywords`: An array of strings. These are used when searching, so add strings that people may use to search for this feature. - * `added`: A string for the version of PHP that the feature was added. Must be in the format `X.Y`, e.g. `7.0`. Use `0.0` if this is not known or appropriate. - * `deprecated`: A string for the version of PHP that the feature was deprecated. Must be in the format `X.Y`, e.g. `8.0`. Use `null` if this is not know or appropriate. - * `removed`: A string for the version of PHP that the feature was removed. Must be in the format `X.Y`, e.g. `8.2`. Use `null` if this is not know or appropriate. - * `resources`: This is an array of objects representing links to documentation or articles about the feature. Each link object has the following properties: - * `name`: The title of the link - * `url`: The URL of the link +- the whole thing is a JSON array +- each entry is an object with the following properties: + - `name`: The name of the feature - plain text only + - `description`: A description of the feature - HTML is allowed, but may not be styled. `` tags are fine. + - `keywords`: An array of strings. These are used when searching, so add strings that people may use to search for this feature. + - `added`: A string for the version of PHP that the feature was added. Must be in the format `X.Y`, e.g. `7.0`. Use `0.0` if this is not known or appropriate. + - `deprecated`: A string for the version of PHP that the feature was deprecated. Must be in the format `X.Y`, e.g. `8.0`. Use `null` if this is not know or appropriate. + - `removed`: A string for the version of PHP that the feature was removed. Must be in the format `X.Y`, e.g. `8.2`. Use `null` if this is not know or appropriate. + - `resources`: This is an array of objects representing links to documentation or articles about the feature. Each link object has the following properties: + - `name`: The title of the link + - `url`: The URL of the link A sample entry: diff --git a/features.js b/features.js index e2cda85..dcc6f7a 100644 --- a/features.js +++ b/features.js @@ -1,595 +1,561 @@ const features = [ - { - name: 'Enums', - description: 'Enums are a way to define a set of named constants.', - keywords: [ - 'constants', 'class', 'classes' - ], - added: '8.1', - deprecated: null, - removed: null, - resources: [ - { - name: 'Enums', - url: 'https://stitcher.io/blog/php-enums' - } - ] - }, - { - name: 'Array unpacking with string keys', - description: 'e.g. $result = [\'a\' => 0, ...$arrayA, ...$arrayB];', - keywords: [ - 'spread', 'unpacking', 'arrays', 'deconstruct' - ], - added: '8.1', - deprecated: null, - removed: null, - resources: [ - { - name: 'RFC (php.net)', - url: 'https://wiki.php.net/rfc/array_unpacking_string_keys' - } - ] - }, - { - name: 'Readonly properties', - description: 'A property can be declared with the readonly modifier, which prevents modification of the property after initialization.', - keywords: [ - 'objects', 'classes', 'properties', 'modifier' - ], - added: '8.1', - deprecated: null, - removed: null, - resources: [ - { - name: 'Readonly properties (php.net)', - url: 'https://www.php.net/manual/en/language.oop5.properties.php#language.oop5.properties.readonly-properties' - } - ] - }, - { - name: 'never type', - description: 'never is a return type indicating the function does not return.', - keywords: [ - 'types', 'typehints', 'return' - ], - added: '8.1', - deprecated: null, - removed: null, - resources: [ - { - name: 'Readonly properties (php.net)', - url: 'https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.never' - } - ] - }, - { - name: 'new in initializers', - description: 'Use new expressions inside parameter default values, attribute arguments, static variable initializers and global constant initializers.', - keywords: [ - 'new', 'objects' - ], - added: '8.1', - deprecated: null, - removed: null, - resources: [ - { - name: 'new in initializers (stitcher.io)', - url: 'https://stitcher.io/blog/php-81-new-in-initializers' - } - ] - }, - { - name: 'First-class callable syntax ', - description: 'The first class callable syntax is introduced as of PHP 8.1.0, as a way of creating anonymous functions from callable.', - keywords: [ - 'closures' - ], - added: '8.1', - deprecated: null, - removed: null, - resources: [ - { - name: 'First class callable syntax (php.net)', - url: 'https://www.php.net/manual/en/functions.first_class_callable_syntax.php' - } - ] - }, - { - name: 'Intersection types', - description: 'An intersection type declaration enforces that a value must belong to all of the declared types.', - keywords: [ - 'types', 'typehints', 'declarations' - ], - added: '8.1', - deprecated: null, - removed: null, - resources: [ - { - name: 'Intersection types (php.net)', - url: 'https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.composite.intersection' - }, - { - name: 'Intersection types (PHP.Watch)', - url: 'https://php.watch/versions/8.1/intersection-types' - } - ] - }, - { - name: 'Attributes', - description: 'Attributes, also known as annotations in many other languages, can be used to add meta data to classes, methods, variables and what not; in a structured way. Like docblocks, but recognised properly by PHP.', - keywords: [ - 'annotations', 'docblocks', 'documentation', 'metadata', 'reflection' - ], - added: '8.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'Attributes (php.net)', - url: 'https://www.php.net/manual/en/language.attributes.overview.php' - }, - { - name: 'Attributes (stitcher.io)', - url: 'https://stitcher.io/blog/attributes-in-php-8' - } - ] - }, - { - name: 'Union types', - description: 'A union type declaration accepts values of multiple different simple types, rather than a single one. Also referred to as composite types.', - keywords: [ - 'types', 'typehints', 'declarations', 'composite type' - ], - added: '8.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'Union types (php.net)', - url: 'https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.composite.union' - } - ] - }, - { - name: 'Constructor promotion', - description: 'Constructor parameters may be promoted to correspond to an object property.', - keywords: [ - 'parameters', 'properties', 'classes', 'promoted' - ], - added: '8.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'Constructor promotion (php.net)', - url: 'https://www.php.net/manual/en/language.oop5.decon.php#language.oop5.decon.constructor.promotion' - } - ] - }, - { - name: 'match expression', - description: 'match is like switch, but returns a value.', - keywords: [ - 'control', 'structures', 'switch', 'conditionals' - ], - added: '8.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'Match expression (php.net)', - url: 'https://www.php.net/manual/en/control-structures.match.php' - } - ] - }, - { - name: 'Named arguments', - description: 'Named arguments allow passing arguments to a function based on the parameter name, rather than the parameter position.', - keywords: [ - 'parameters', 'call', 'functions' - ], - added: '8.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'Named arguments (php.net)', - url: 'https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments' - } - ] - }, - { - name: 'Nullsafe operator', - description: 'Nullsafe operator allows you to access properties and methods of nullable objects. e.g. $country = $session?->user?->getAddress()?->country;', - keywords: [ - 'null' - ], - added: '8.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'Nullsafe operator (stitcher.io)', - url: 'https://stitcher.io/blog/php-8-nullsafe-operator' - } - ] - }, - { - name: 'str_contains', - description: 'Determine if a string contains a given substring', - keywords: [ - 'functions', 'helpers', 'strings', 'utilities', 'utils' - ], - added: '8.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'str_contains (php.net)', - url: 'https://www.php.net/manual/en/function.str-contains.php' - } - ] - }, - { - name: 'str_starts_with', - description: 'Check if a string starts with a given substring', - keywords: [ - 'functions', 'helpers', 'strings', 'utilities', 'utils' - ], - added: '8.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'str_starts_with (php.net)', - url: 'https://www.php.net/manual/en/function.str-starts-with.php' - } - ] - }, - { - name: 'str_ends_with', - description: 'Check if a string ends with a given substring', - keywords: [ - 'functions', 'helpers', 'strings', 'utilities', 'utils' - ], - added: '8.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'str_ends_with (php.net)', - url: 'https://www.php.net/manual/en/function.str-ends-with.php' - } - ] - }, - { - name: 'Throw expression', - description: 'The throw keyword is an expression, therefore an exception can be thrown in any expression context.', - keywords: [ - 'throw', 'expression', 'exceptions' - ], - added: '8.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'Exceptions (php.net)', - url: 'https://www.php.net/manual/en/language.exceptions.php' - }, - { - name: 'RFC (php.net)', - url: 'https://wiki.php.net/rfc/throw_expression' - } - ] - }, - { - name: 'Typed properties', - description: 'Class properties now support type declarations.', - keywords: [ - 'properties', 'class', 'types', 'typehints' - ], - added: '7.4', - deprecated: null, - removed: null, - resources: [ - { - name: 'Typed properties in PHP 7.4 (stitcher.io)', - url: 'https://stitcher.io/blog/typed-properties-in-php-74' - } - ] - }, - { - name: 'Arrow functions', - description: 'Arrow functions are a shorthand for anonymous functions: fn (argument_list) => expr.', - keywords: [ - 'closures', 'anonymous', 'shorthand', 'short' - ], - added: '7.4', - deprecated: null, - removed: null, - resources: [ - { - name: 'Arrow functions (php.net)', - url: 'https://www.php.net/manual/en/functions.arrow.php' - } - ] - }, - { - name: 'Anonymous classes', - description: 'Anonymous classes can be created with new class. They\'re used for throw away objects.', - keywords: [ - 'closures', 'anonymous', 'class' - ], - added: '7.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'Anonymous classes (php.net)', - url: 'https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.anonymous-classes' - } - ] - }, - { - name: 'Array unpacking (numeric keys only)', - description: 'e.g. $result = [0, …$arrayA, …$arrayB, 6, 7];', - keywords: [ - 'spread', 'unpacking', 'arrays', 'deconstruct' - ], - added: '7.4', - deprecated: null, - removed: null, - resources: [ - { - name: 'RFC (php.net)', - url: 'https://wiki.php.net/rfc/spread_operator_for_array' - } - ] - }, - { - name: 'Underscore as numeric separator', - description: 'An underscore "_" can be used in numeric literals to visually separate groups of digits.', - keywords: [ - 'numbers', 'underscore', 'literals' - ], - added: '7.4', - deprecated: null, - removed: null, - resources: [ - { - name: 'Integers (php.net)', - url: 'https://www.php.net/manual/en/language.types.integer.php' - }, - { - name: 'RFC (php.net)', - url: 'https://wiki.php.net/rfc/numeric_literal_separator' - } - ] - }, - { - name: 'Splat operator / argument unpacking (... operator)', - description: 'The ... operator, aka the splat operator or array unpacking operator', - keywords: [ - 'spread', 'unpacking', 'arrays', 'splat' - ], - added: '5.6', - deprecated: null, - removed: null, - resources: [ - { - name: 'Argument unpacking via ...', - url: 'https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.splat' - } - ] - }, - { - name: 'Multi catch exception handline', - description: 'A catch block may specify multiple exceptions using the pipe (|) character', - keywords: [ - 'exceptions' - ], - added: '7.1', - deprecated: null, - removed: null, - resources: [ - { - name: 'Exceptions (php.net)', - url: 'https://www.php.net/manual/en/language.exceptions.php' - } - ] - }, - { - name: 'nullable type declarations', - description: 'Type declarations can be marked nullable by prefixing the type name with a question mark (?). This signifies that the value can be of the specified type or null.', - keywords: [ - 'declarations', 'typehints', 'return' - ], - added: '7.1', - deprecated: null, - removed: null, - resources: [ - { - name: 'Nullable type (php.net)', - url: 'https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.nullable' - } - ] - }, - { - name: 'void return type', - description: 'void is a return type indicating the function does not return a value.', - keywords: [ - 'declarations', 'typehints', 'return' - ], - added: '7.1', - deprecated: null, - removed: null, - resources: [ - { - name: 'void return type (php.net)', - url: 'https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.return-only' - } - ] - }, - { - name: 'Group use declarations', - description: 'Classes, functions and constants being imported from the same namespace can be grouped together in a single use statement.', - keywords: [ - 'imports' - ], - added: '7.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'Group use declarations (php.net)', - url: 'https://www.php.net/manual/en/language.namespaces.importing.php#language.namespaces.importing.group' - } - ] - }, - { - name: 'Null coalescing operator', - description: 'Use ??', - keywords: [ - 'short', 'shorthand', 'null', 'conditional', 'operators' - ], - added: '7.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'Null coalescing operator (php.net)', - url: 'https://www.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.coalesce' - } - ] - }, - { - name: 'Return type declarations', - description: 'Return type declarations specify the type of the value that will be returned from a function', - keywords: [ - 'typehints', 'types' - ], - added: '7.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'Return type declarations (php.net)', - url: 'https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.return-type-declarations' - } - ] - }, - { - name: 'Spaceship operator', - description: 'Use <=> for comparisons for sorting', - keywords: [ - 'short', 'shorthand', 'spaceship', 'space ship', 'comparisons', 'operators', 'sorting' - ], - added: '7.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'Spaceship operator (stitcher.io)', - url: 'https://stitcher.io/blog/shorthand-comparisons-in-php#spaceship-operator' - } - ] - }, - { - name: 'Scalar type hints', - description: 'As of PHP 7, the scalar types (integers, floating point numbers, booleans and strings) can be used as type hints. This is in addition to being able to use classes, arrays and callables, which were already allowed.', - keywords: [ - 'types', 'typehints', 'typed' - ], - added: '7.0', - deprecated: null, - removed: null, - resources: [ - { - name: 'What is new in PHP 7?', - url: 'https://trimurtidev.in/what-is-new-in-php-7/' - } - ] - }, - { - name: 'Shorthand Ternary (?:)', - description: 'Use of ?: - actually added in PHP v5.3!', - keywords: [ - 'short', 'shorthand', 'ternary', 'conditional', 'operators' - ], - added: '5.6', - deprecated: null, - removed: null, - resources: [ - { - name: 'Shorthand ternary (stitcher.io)', - url: 'https://stitcher.io/blog/shorthand-comparisons-in-php#shorthand-ternary-operator' - } - ] - }, - { - name: 'get_magic_quotes_gpc', - description: 'Gets the current configuration setting of magic_quotes_gpc', - keywords: [ - 'functions', 'deprecated', 'removed' - ], - added: '0.0', - deprecated: '7.4', - removed: '8.0', - resources: [ - { - name: 'get_magic_quotes_gpc (php.net)', - url: 'https://www.php.net/manual/en/function.get-magic-quotes-gpc.php' - } - ] - }, - { - name: 'FILTER_FLAG_SCHEME_REQUIRED', - description: 'Filter flag for `filter_var()`', - keywords: [ - 'filter', 'constant', 'deprecated', 'removed' - ], - added: '0.0', - deprecated: '7.3.0', - removed: '8.0', - resources: [ - { - name: 'Validate filters', - url: 'https://www.php.net/manual/en/filter.filters.validate.php' - } - ] - }, - { - name: 'FILTER_FLAG_HOST_REQUIRED', - description: 'Filter flag for `filter_var()`', - keywords: [ - 'filter', 'constant', 'deprecated', 'removed' - ], - added: '0.0', - deprecated: '7.3.0', - removed: '8.0', - resources: [ - { - name: 'Validate filters', - url: 'https://www.php.net/manual/en/filter.filters.validate.php' - } - ] - }, - { - name: 'Fibers (Fiber class, Fiber exceptions)', - description: 'Lightweight concurrency for PHP', - keywords: [ - 'class', 'types', 'new feature', 'functionality', 'concurrency' - ], - added: '8.1', - resources: [ - { - name: 'PHP.Watch Introduction to Fibers', - url: 'https://php.watch/versions/8.1/fibers' - }, { - name: 'PHP Documentation', - url: 'https://www.php.net/manual/en/language.fibers.php' - } - ] - } -] + { + name: "Enums", + description: "Enums are a way to define a set of named constants.", + keywords: ["constants", "class", "classes"], + added: "8.1", + deprecated: null, + removed: null, + resources: [ + { + name: "Enums", + url: "https://stitcher.io/blog/php-enums", + }, + ], + }, + { + name: "Array unpacking with string keys", + description: + "e.g. $result = ['a' => 0, ...$arrayA, ...$arrayB];", + keywords: ["spread", "unpacking", "arrays", "deconstruct"], + added: "8.1", + deprecated: null, + removed: null, + resources: [ + { + name: "RFC (php.net)", + url: "https://wiki.php.net/rfc/array_unpacking_string_keys", + }, + ], + }, + { + name: "Readonly properties", + description: + "A property can be declared with the readonly modifier, which prevents modification of the property after initialization.", + keywords: ["objects", "classes", "properties", "modifier"], + added: "8.1", + deprecated: null, + removed: null, + resources: [ + { + name: "Readonly properties (php.net)", + url: "https://www.php.net/manual/en/language.oop5.properties.php#language.oop5.properties.readonly-properties", + }, + ], + }, + { + name: "never type", + description: + "never is a return type indicating the function does not return.", + keywords: ["types", "typehints", "return"], + added: "8.1", + deprecated: null, + removed: null, + resources: [ + { + name: "Readonly properties (php.net)", + url: "https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.never", + }, + ], + }, + { + name: "new in initializers", + description: + "Use new expressions inside parameter default values, attribute arguments, static variable initializers and global constant initializers.", + keywords: ["new", "objects"], + added: "8.1", + deprecated: null, + removed: null, + resources: [ + { + name: "new in initializers (stitcher.io)", + url: "https://stitcher.io/blog/php-81-new-in-initializers", + }, + ], + }, + { + name: "First-class callable syntax ", + description: + "The first class callable syntax is introduced as of PHP 8.1.0, as a way of creating anonymous functions from callable.", + keywords: ["closures"], + added: "8.1", + deprecated: null, + removed: null, + resources: [ + { + name: "First class callable syntax (php.net)", + url: "https://www.php.net/manual/en/functions.first_class_callable_syntax.php", + }, + ], + }, + { + name: "Intersection types", + description: + "An intersection type declaration enforces that a value must belong to all of the declared types.", + keywords: ["types", "typehints", "declarations"], + added: "8.1", + deprecated: null, + removed: null, + resources: [ + { + name: "Intersection types (php.net)", + url: "https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.composite.intersection", + }, + { + name: "Intersection types (PHP.Watch)", + url: "https://php.watch/versions/8.1/intersection-types", + }, + ], + }, + { + name: "Attributes", + description: + "Attributes, also known as annotations in many other languages, can be used to add meta data to classes, methods, variables and what not; in a structured way. Like docblocks, but recognised properly by PHP.", + keywords: [ + "annotations", + "docblocks", + "documentation", + "metadata", + "reflection", + ], + added: "8.0", + deprecated: null, + removed: null, + resources: [ + { + name: "Attributes (php.net)", + url: "https://www.php.net/manual/en/language.attributes.overview.php", + }, + { + name: "Attributes (stitcher.io)", + url: "https://stitcher.io/blog/attributes-in-php-8", + }, + ], + }, + { + name: "Union types", + description: + "A union type declaration accepts values of multiple different simple types, rather than a single one. Also referred to as composite types.", + keywords: ["types", "typehints", "declarations", "composite type"], + added: "8.0", + deprecated: null, + removed: null, + resources: [ + { + name: "Union types (php.net)", + url: "https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.composite.union", + }, + ], + }, + { + name: "Constructor promotion", + description: + "Constructor parameters may be promoted to correspond to an object property.", + keywords: ["parameters", "properties", "classes", "promoted"], + added: "8.0", + deprecated: null, + removed: null, + resources: [ + { + name: "Constructor promotion (php.net)", + url: "https://www.php.net/manual/en/language.oop5.decon.php#language.oop5.decon.constructor.promotion", + }, + ], + }, + { + name: "match expression", + description: + "match is like switch, but returns a value.", + keywords: ["control", "structures", "switch", "conditionals"], + added: "8.0", + deprecated: null, + removed: null, + resources: [ + { + name: "Match expression (php.net)", + url: "https://www.php.net/manual/en/control-structures.match.php", + }, + ], + }, + { + name: "Named arguments", + description: + "Named arguments allow passing arguments to a function based on the parameter name, rather than the parameter position.", + keywords: ["parameters", "call", "functions"], + added: "8.0", + deprecated: null, + removed: null, + resources: [ + { + name: "Named arguments (php.net)", + url: "https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments", + }, + ], + }, + { + name: "Nullsafe operator", + description: + "Nullsafe operator allows you to access properties and methods of nullable objects. e.g. $country = $session?->user?->getAddress()?->country;", + keywords: ["null"], + added: "8.0", + deprecated: null, + removed: null, + resources: [ + { + name: "Nullsafe operator (stitcher.io)", + url: "https://stitcher.io/blog/php-8-nullsafe-operator", + }, + ], + }, + { + name: "str_contains", + description: "Determine if a string contains a given substring", + keywords: ["functions", "helpers", "strings", "utilities", "utils"], + added: "8.0", + deprecated: null, + removed: null, + resources: [ + { + name: "str_contains (php.net)", + url: "https://www.php.net/manual/en/function.str-contains.php", + }, + ], + }, + { + name: "str_starts_with", + description: "Check if a string starts with a given substring", + keywords: ["functions", "helpers", "strings", "utilities", "utils"], + added: "8.0", + deprecated: null, + removed: null, + resources: [ + { + name: "str_starts_with (php.net)", + url: "https://www.php.net/manual/en/function.str-starts-with.php", + }, + ], + }, + { + name: "str_ends_with", + description: "Check if a string ends with a given substring", + keywords: ["functions", "helpers", "strings", "utilities", "utils"], + added: "8.0", + deprecated: null, + removed: null, + resources: [ + { + name: "str_ends_with (php.net)", + url: "https://www.php.net/manual/en/function.str-ends-with.php", + }, + ], + }, + { + name: "Throw expression", + description: + "The throw keyword is an expression, therefore an exception can be thrown in any expression context.", + keywords: ["throw", "expression", "exceptions"], + added: "8.0", + deprecated: null, + removed: null, + resources: [ + { + name: "Exceptions (php.net)", + url: "https://www.php.net/manual/en/language.exceptions.php", + }, + { + name: "RFC (php.net)", + url: "https://wiki.php.net/rfc/throw_expression", + }, + ], + }, + { + name: "Typed properties", + description: "Class properties now support type declarations.", + keywords: ["properties", "class", "types", "typehints"], + added: "7.4", + deprecated: null, + removed: null, + resources: [ + { + name: "Typed properties in PHP 7.4 (stitcher.io)", + url: "https://stitcher.io/blog/typed-properties-in-php-74", + }, + ], + }, + { + name: "Arrow functions", + description: + "Arrow functions are a shorthand for anonymous functions: fn (argument_list) => expr.", + keywords: ["closures", "anonymous", "shorthand", "short"], + added: "7.4", + deprecated: null, + removed: null, + resources: [ + { + name: "Arrow functions (php.net)", + url: "https://www.php.net/manual/en/functions.arrow.php", + }, + ], + }, + { + name: "Anonymous classes", + description: + "Anonymous classes can be created with new class. They're used for throw away objects.", + keywords: ["closures", "anonymous", "class"], + added: "7.0", + deprecated: null, + removed: null, + resources: [ + { + name: "Anonymous classes (php.net)", + url: "https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.anonymous-classes", + }, + ], + }, + { + name: "Array unpacking (numeric keys only)", + description: "e.g. $result = [0, …$arrayA, …$arrayB, 6, 7];", + keywords: ["spread", "unpacking", "arrays", "deconstruct"], + added: "7.4", + deprecated: null, + removed: null, + resources: [ + { + name: "RFC (php.net)", + url: "https://wiki.php.net/rfc/spread_operator_for_array", + }, + ], + }, + { + name: "Underscore as numeric separator", + description: + 'An underscore "_" can be used in numeric literals to visually separate groups of digits.', + keywords: ["numbers", "underscore", "literals"], + added: "7.4", + deprecated: null, + removed: null, + resources: [ + { + name: "Integers (php.net)", + url: "https://www.php.net/manual/en/language.types.integer.php", + }, + { + name: "RFC (php.net)", + url: "https://wiki.php.net/rfc/numeric_literal_separator", + }, + ], + }, + { + name: "Splat operator / argument unpacking (... operator)", + description: + "The ... operator, aka the splat operator or array unpacking operator", + keywords: ["spread", "unpacking", "arrays", "splat"], + added: "5.6", + deprecated: null, + removed: null, + resources: [ + { + name: "Argument unpacking via ...", + url: "https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.splat", + }, + ], + }, + { + name: "Multi catch exception handline", + description: + "A catch block may specify multiple exceptions using the pipe (|) character", + keywords: ["exceptions"], + added: "7.1", + deprecated: null, + removed: null, + resources: [ + { + name: "Exceptions (php.net)", + url: "https://www.php.net/manual/en/language.exceptions.php", + }, + ], + }, + { + name: "nullable type declarations", + description: + "Type declarations can be marked nullable by prefixing the type name with a question mark (?). This signifies that the value can be of the specified type or null.", + keywords: ["declarations", "typehints", "return"], + added: "7.1", + deprecated: null, + removed: null, + resources: [ + { + name: "Nullable type (php.net)", + url: "https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.nullable", + }, + ], + }, + { + name: "void return type", + description: + "void is a return type indicating the function does not return a value.", + keywords: ["declarations", "typehints", "return"], + added: "7.1", + deprecated: null, + removed: null, + resources: [ + { + name: "void return type (php.net)", + url: "https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.return-only", + }, + ], + }, + { + name: "Group use declarations", + description: + "Classes, functions and constants being imported from the same namespace can be grouped together in a single use statement.", + keywords: ["imports"], + added: "7.0", + deprecated: null, + removed: null, + resources: [ + { + name: "Group use declarations (php.net)", + url: "https://www.php.net/manual/en/language.namespaces.importing.php#language.namespaces.importing.group", + }, + ], + }, + { + name: "Null coalescing operator", + description: "Use ??", + keywords: ["short", "shorthand", "null", "conditional", "operators"], + added: "7.0", + deprecated: null, + removed: null, + resources: [ + { + name: "Null coalescing operator (php.net)", + url: "https://www.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.coalesce", + }, + ], + }, + { + name: "Return type declarations", + description: + "Return type declarations specify the type of the value that will be returned from a function", + keywords: ["typehints", "types"], + added: "7.0", + deprecated: null, + removed: null, + resources: [ + { + name: "Return type declarations (php.net)", + url: "https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.return-type-declarations", + }, + ], + }, + { + name: "Spaceship operator", + description: "Use <=> for comparisons for sorting", + keywords: [ + "short", + "shorthand", + "spaceship", + "space ship", + "comparisons", + "operators", + "sorting", + ], + added: "7.0", + deprecated: null, + removed: null, + resources: [ + { + name: "Spaceship operator (stitcher.io)", + url: "https://stitcher.io/blog/shorthand-comparisons-in-php#spaceship-operator", + }, + ], + }, + { + name: "Scalar type hints", + description: + "As of PHP 7, the scalar types (integers, floating point numbers, booleans and strings) can be used as type hints. This is in addition to being able to use classes, arrays and callables, which were already allowed.", + keywords: ["types", "typehints", "typed"], + added: "7.0", + deprecated: null, + removed: null, + resources: [ + { + name: "What is new in PHP 7?", + url: "https://trimurtidev.in/what-is-new-in-php-7/", + }, + ], + }, + { + name: "Shorthand Ternary (?:)", + description: "Use of ?: - actually added in PHP v5.3!", + keywords: ["short", "shorthand", "ternary", "conditional", "operators"], + added: "5.6", + deprecated: null, + removed: null, + resources: [ + { + name: "Shorthand ternary (stitcher.io)", + url: "https://stitcher.io/blog/shorthand-comparisons-in-php#shorthand-ternary-operator", + }, + ], + }, + { + name: "get_magic_quotes_gpc", + description: "Gets the current configuration setting of magic_quotes_gpc", + keywords: ["functions", "deprecated", "removed"], + added: "0.0", + deprecated: "7.4", + removed: "8.0", + resources: [ + { + name: "get_magic_quotes_gpc (php.net)", + url: "https://www.php.net/manual/en/function.get-magic-quotes-gpc.php", + }, + ], + }, + { + name: "FILTER_FLAG_SCHEME_REQUIRED", + description: "Filter flag for `filter_var()`", + keywords: ["filter", "constant", "deprecated", "removed"], + added: "0.0", + deprecated: "7.3.0", + removed: "8.0", + resources: [ + { + name: "Validate filters", + url: "https://www.php.net/manual/en/filter.filters.validate.php", + }, + ], + }, + { + name: "FILTER_FLAG_HOST_REQUIRED", + description: "Filter flag for `filter_var()`", + keywords: ["filter", "constant", "deprecated", "removed"], + added: "0.0", + deprecated: "7.3.0", + removed: "8.0", + resources: [ + { + name: "Validate filters", + url: "https://www.php.net/manual/en/filter.filters.validate.php", + }, + ], + }, + { + name: "Fibers (Fiber class, Fiber exceptions)", + description: "Lightweight concurrency for PHP", + keywords: ["class", "types", "new feature", "functionality", "concurrency"], + added: "8.1", + resources: [ + { + name: "PHP.Watch Introduction to Fibers", + url: "https://php.watch/versions/8.1/fibers", + }, + { + name: "PHP Documentation", + url: "https://www.php.net/manual/en/language.fibers.php", + }, + ], + }, +]; diff --git a/index.html b/index.html index 2d10ccd..e60475e 100644 --- a/index.html +++ b/index.html @@ -1,102 +1,173 @@ - - - - - - - - + + + + + + + + Can I PHP? - caniuse.com but for PHP features - - - - -
-
- -
Unofficial and incomplete
-

Can I PHP?

-

PHP feature support by version - like caniuse.com but for PHP.
- This is a list of language features and functions added or removed in recent PHP versions. It is not an exhaustive reference.

-
-
-
- + + + +
+
+ +
+ Unofficial and incomplete +
+

Can I PHP?

+

+ PHP feature support by version - like caniuse.com but for PHP.
+ This is a list of language features and functions added or removed in + recent PHP versions. It is not an exhaustive reference. +

+
+
+ + + + +
+

Nothing matches!

+

It could be that:

+
    +
  • + We know about the thing, but your search didn't find it - try + again! +
  • +
  • + We don't know about the thing: This is not a list of ALL PHP + functions and features, just those added or removed in recent + versions. And the information is not yet complete so please bear + with us as we add more data. +
  • +
+

+ If you think something is missing then feel free to open a pull + request on + the GitHub repo + to add it. +

+
+ +
+