1. Go to this page and download the library: Download snipershady/typeidentifier 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/ */
snipershady / typeidentifier example snippets
use TypeIdentifier\Service\EffectivePrimitiveTypeIdentifierService;
$ept = new EffectivePrimitiveTypeIdentifierService();
$result = $ept->getTypedValue(1); // Result will be 1 with type int
$ept = new EffectivePrimitiveTypeIdentifierService();
$result = $ept->getTypedValue("1"); // Result will be 1 with type int
$array["value"] = "1.1";
$ept = new EffectivePrimitiveTypeIdentifierService();
$result = $ept->getTypedValue($array["value"]); // Result will be 1.1 with type float
$value = "1.1a";
$array["value"] = $value;
$ept = new EffectivePrimitiveTypeIdentifierService();
$result = $ept->getTypedValue($array["value"]); // Result will be "1.1a" with type string
$ept = new EffectivePrimitiveTypeIdentifierService();
$result = $ept->getTypedValue(1 === 1); // result will be true type bool
$ept = new EffectivePrimitiveTypeIdentifierService();
$result = $ept->getTypedValue("snipershady ", true); // Trim enabled. Result will be "snipershady" without any whitespace and type string
$ept = new EffectivePrimitiveTypeIdentifierService();
$trim = true; // Can be false, is not mandatory if you want to force string sanitizing
$forceString = true;
$result = $ept->getTypedValue("1", $trim, $forceString); // Result will be "1" with type string and will not handled as integer
$value = "snipershady";
$array["value"] = $value;
$ept = new EffectivePrimitiveTypeIdentifierService();
$result = $ept->getTypedValueFromArray("value", $array); // Result will be "snipershady" sanitized and type string
$value = "snipershady";
$array["value"] = $value;
$ept = new EffectivePrimitiveTypeIdentifierService();
$result = $ept->getTypedValueFromArray("invalid_offset", $array); // Result null. "invalid_offset" is not a valid offset for the array.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.