-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphp.jsonc
50 lines (46 loc) · 1.78 KB
/
php.jsonc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
// Place your snippets for php here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"PHP - Display General Errors": {
"prefix": "PHP - Display General Errors",
"body": [
"ini_set('display_errors', 1);",
"ini_set('display_startup_errors', 1);",
"error_reporting(E_ALL);",
"$0"
],
"description": "Outputs PHP errors to the webpage."
},
// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);
//
"PHP - JSON Decode With Comments": {
"prefix": "PHP - JSON Decode With Comments",
"body": [
"function json_decode_commented(\\$json, \\$assoc = false, \\$maxDepth = 512, \\$opts = 0)",
"{",
"\t\\$json = preg_replace('~(\" (?:\\\\\\\\\\\\\\. | [^\"])*+ \") | \\# [^\\v]*+ | // [^\\v]*+ | /\\* .*? \\*/~xs', '\\$1', \\$json);",
"\t",
"\treturn json_decode(\\$json, \\$assoc, \\$maxDepth, \\$opts);",
"}"
],
"description": "Outputs PHP function that decodes JSON and strips away comments."
}
// function json_decode_commented($json, $assoc = false, $maxDepth = 512, $opts = 0)
// {
// $json = preg_replace('~(" (?:\\\\. | [^"])*+ ") | \# [^\v]*+ | // [^\v]*+ | /\* .*? \*/~xs', '$1', $json);
// return json_decode($json, $assoc, $maxDepth, $opts);
// }
}