Files
leenooks/src/helpers.php
2020-01-14 21:43:40 +11:00

29 lines
486 B
PHP

<?php
// is_json helper
if (! function_exists('is_json')) {
function is_json($string) {
try {
json_decode($string);
} catch (\Exception $e) {
return FALSE;
}
return (json_last_error() == JSON_ERROR_NONE);
}
}
// Inverse of array_dot()
if (! function_exists('array_undot')) {
function array_undot($dotNotationArray)
{
$array = [];
foreach ($dotNotationArray as $key => $value) {
\Illuminate\Support\Arr::set($array, $key, $value);
}
return $array;
}
}