Using list() function to swap variables values without adding more variables.
$url = 'blog:5';
list($type, $id) = explode(':', $url);
// in case that the url is 5:block
if (!is_numeric($id)) {
list($type, $id) = [$id, $type];
}
Using list() function to swap variables values without adding more variables.
$url = 'blog:5';
list($type, $id) = explode(':', $url);
// in case that the url is 5:block
if (!is_numeric($id)) {
list($type, $id) = [$id, $type];
}
You must be logged in to post a comment.