1. Go to this page and download the library: Download dennobaby/pathfinder 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/ */
echo PathFinder::setPathValue($array, 'some.multi.dimensional.array', 'bar');
//would return 'bar'
//let's check it:
echo PathFinder::getPathValue($array, 'some.multi.dimensional.array');
//would return true.
//but a nonexisting path?
echo PathFinder::setPathValue($array, 'some.multi.nonexisting.key', 'foobar');
//would return false, because the path don't exist!
//but you want it to be created and the value set? No problem:
echo PathFinder::setPathValue($array, 'some.multi.nonexisting.key', 'foobar', true);
//the last parameter, named 'force', will create it for you if set to true and therefor return 'foobar'
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.