PHP code example of wrkflow / php-get-typed-value
1. Go to this page and download the library: Download wrkflow/php-get-typed-value 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/ */
wrkflow / php-get-typed-value example snippets
use Wrkflow\GetValue\GetValue;
use Wrkflow\GetValue\DataHolders\ArrayData;
$data = new GetValue(new ArrayData([
'address' => [
'street' => [
'number' => '13',
],
'name' => '',
]
]));
$data->getInt('address.street.number') // Returns: 13 (int)
$data->getString('address.street.name') // Returns: null because value does not exists
$data->getRequiredString('address.street.name') // Returns: throws MissingValueForKeyException exception