1. Go to this page and download the library: Download sspat/reserved-words library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sspat / reserved-words example snippets
use sspat\ReservedWords\ReservedWords;
$reservedWords = new ReservedWords();
$word = 'list';
/**
* Checks that the word is reserved in any PHP version.
* It is still possible to use reserved words in php code in many places, but generally you should avoid it.
* This method also returns true for words that are marked as "soft" reserved in the PHP docs and may
* become reserved in future versions of the language.
*/
$isReserved = $reservedWords->isReserved($word);
/**
* Checks that the word cannot be used as a constant name in your current php version.
*/
$cannotUseAsConstantName = $reservedWords->isReservedConstantName($word);
/**
* Checks that the word cannot be used as a namespace part in your current php version.
*
* This is used for checking parts of namespaces, not full namespace strings.
* E.g. calling this with `Some\Namespace\String` is incorrect, you should make three separate calls
* with `Some`, `Namespace` and `String`.
*/
$cannotUseAsNamespaceName = $reservedWords->isReservedNamespaceName($word);
/**
* Checks that the word cannot be used as a class/interface/trait name in your current php version.
*/
$cannotUseAsNamespaceName = $reservedWords->isReservedClassName($word);
/**
* Checks that the word cannot be used as a function name in your current php version.
*/
$cannotUseAsFunctionName = $reservedWords->isReservedFunctionName($word);
/**
* Checks that the word cannot be used as a method name in your current php version.
*/
$cannotUseAsMethodName = $reservedWords->isReservedMethodName($word);
/**
* The following methods also accept a second parameter, to check against a PHP version different than your current runtime
*/
$cannotUseAsConstantName = $reservedWords->isReservedConstantName($word, '5.6');
$cannotUseAsNamespaceName = $reservedWords->isReservedNamespaceName($word, '5.6.1');
$cannotUseAsNamespaceName = $reservedWords->isReservedClassName($word, '5.6.1');
$cannotUseAsFunctionName = $reservedWords->isReservedFunctionName($word, '8.0');
$cannotUseAsMethodName = $reservedWords->isReservedMethodName($word, '7.4.2');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.