Skip to content

Commit d1f4545

Browse files
committed
IHF: is_json doc added.
1 parent b29a13a commit d1f4545

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,16 @@ Lalala
3636
3737
#### `is_json`
3838
39-
Lalala
39+
Checks if specified variable is valid json-encoded string or not:
40+
```php
41+
$isJson = is_json('{"foo":1,"bar":2,"baz":3}');
42+
43+
// true
44+
```
45+
46+
Boolean is returned by default, however, function can return decoded json, as associative array, if you pass the second `return` parameter as `true`:
47+
```php
48+
$decoded = is_json('{"foo":1,"bar":2,"baz":3}', true);
49+
50+
// ['foo' => 1, 'bar' => 2, 'baz' => 3]
51+
```

0 commit comments

Comments
 (0)