|Last Updated|| ||Ratings|| ||Unique User Downloads|| ||Download Rankings|
|2022-08-23 (7 months ago) ||Not yet rated by the users||Total: 66 ||All time: 10,165 This week: 349|
This simple class can get the names of each primary PHP data type.
It contains constants with the string values of all PHP variable types.
Applications can use it to get the names of the types to use this class together with the PHP functions SetType and GetType.
|PHP is a weakly typed language. This fact means that it allows setting the type of variable values when executing the PHP code.
Although this makes the PHP language very flexible and tolerant of the developer's mistakes, sometimes it can be hard to debug subtle bugs caused by the developer's errors.
In practice, that can mean that developers may take more time to fix subtle bugs that probably would not exist if PHP was a strongly typed language.
This package provides a solution that can help to avoid those bugs. It gives the name strings of the PHP variable types.
So, if a developer wants to use the PHP GetType and SetType functions to get or set the variable type, the developer can use this class.
So, if the developer makes a mistake in the name of a constant provided by the class, PHP will trigger an error that can make it easier to find bugs caused by typing the name of a PHP type.
PHP type names ??
Get all valid PHP type names with constants.
Simple library containing the list of constants for the available PHP data types. Use those constant types in your project when you need to mention a data type, use those constants instead of hardcoding them.
Install it easily with Composer
composer require ph-7/datatype
require_once __DIR__ . '/vendor/autoload.php';
$id = settype($_GET['id'], Type::STRING);
$name = settype($inputName, Type::STRING);
? Who cooked it?
Pierre-Henry Soria, a highly passionate, zen & pragmatic software engineer ?
PHP type names is generously distributed under the MIT.
<!-- GitHub's Markdown reference links -->
<!-- Generated by https://github.com/pH-7/cool-readme-generator -->
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.