PHP code example of amsify42 / php-vars-data
1. Go to this page and download the library: Download amsify42/php-vars-data 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/ */
amsify42 / php-vars-data example snippets
use Amsify42\PHPVarsData\Data\Evaluate;
Evaluate::toValue('true');
Evaluate::toValue('false');
Evaluate::toValue('null');
Evaluate::toValue('42');
Evaluate::toValue('4.2');
Evaluate::toValue('Amsify');
Evaluate::toString(true);
Evaluate::toString(false);
Evaluate::toString(null);
Evaluate::toString(42);
Evaluate::toString(4.2);
Evaluate::toCount('2.5K');
Evaluate::toCount('4.2M');
Evaluate::toCount('1.1B');
evaluate_to_value('true');
evaluate_to_string(true);
evaluate_to_count('3.1k');
use Amsify42\PHPVarsData\Data\ArraySimple;
$arraySimple = new ArraySimple([1,2,3]);
$arraySimple = new get_array_simple([1,2,3]);
foreach($arraySimple as $item)
{
echo $item;
}
$item[] = 4;
unset($item[4]);
$arraySimple = get_array_simple([
'name' => 'amsify',
'detail' => [
'location' => 'somewhere',
'more_detail' => [
'do' => 'something',
'ids' => [42]
]
]
]);
echo $arraySimple->get('detail.location');
$arraySimple->set('detail.more_detail.do', 'nothing');
echo $arraySimple->get('detail.more_detail.do');