• Easy swapping PHP vairables

    February 18, 2022

    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]; }

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org