note 115468 added to function.list
| From: | JohnGalt | Date: | Tue, 29 Jul 2014 15:51:52 +0000 |
| Subject: | note 115468 added to function.list | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-200069@lists.php.net to get a copy of this message | ||
This is one of very few times that I think it can make sense to use the error-suppression operator
(@).
For example, a rudimentary API (assuming you're not using a framework) might work off of
$_SERVER['PATH_INFO'] to run an operation.
For instance, a call to api.json.php/users might return an array of user IDs and a call to
api.json.php/users/42 might return details about the user with the ID 42.
<?php
// ...
@list ($dataset, $identifier) = explode('/', $_SERVER['PATH_INFO']);
switch ($dataset) {
case 'users':
if (isset($identifier)) {
exit (json_encode(get_user($identifier)));
} else {
exit (json_encode(get_users()));
}
// ...
}
// ...
----
Server IP: 72.52.91.14
Probable Submitter: 68.14.223.28
----
Manual Page -- http://php.net/manual/en/function.list.php
Edit -- https://master.php.net/note/edit/115468
Del: integrated -- https://master.php.net/note/delete/115468/integrated
Del: useless -- https://master.php.net/note/delete/115468/useless
Del: bad code -- https://master.php.net/note/delete/115468/bad+code
Del: spam -- https://master.php.net/note/delete/115468/spam
Del: non-english -- https://master.php.net/note/delete/115468/non-english
Del: in docs -- https://master.php.net/note/delete/115468/in+docs
Del: other reasons-- https://master.php.net/note/delete/115468
Reject -- https://master.php.net/note/reject/115468
Search -- https://master.php.net/manage/user-notes.php