1. Go to this page and download the library: Download jbizzay/php-dot 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/ */
$dot->define('leads.emails'); // Sets to an array
$hits = $dot->define('stats.mobile.hits', 0);
$dot->define('stats.console.hits', function () {
// This function is called if this key is not set yet
return 0;
});
// Merge into whole data array
$dot->merge([
'stats' => [
'web' => [
'hits' => 123,
'leads' => 321
]
]
]);
$dot->get();
/* Returns:
Array
(
[stats] => Array
(
[web] => Array
(
[hits] => 123
[last_updated] => DateTime Object
(
[date] => 2017-07-25 13:34:49.000000
[timezone_type] => 3
[timezone] => America/Los_Angeles
)
[allow_tracking] => 1
[leads] => 321
)
[mobile] => Array
(
)
)
)
*/
// Merge array into a dot path
$dot->merge('stats.mobile', [
'issues' => 33
]);
// Merge using function
$dot->merge('stats.mobile', function ($mobile) {
return ['updated' => new DateTime];
});
// Merge into whole data array with function
$dot->merge(function ($data) {
return ['new' => 123];
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.