Added helpers.php
This commit is contained in:
15
src/helpers.php
Normal file
15
src/helpers.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user