// $output .=$chars[$i]; // } // return $output; // } // echo my_strrev("motorcycle"); // return $_GET[$parameter_name] or '' if it doesn't exsist. ############# USE THIS FOR $_GET issets on all PHP projects!!!################################### // function getStuff($parameter_name, $default=''){ // if(isset($_GET[$parameter_name])){ // return $_GET[$parameter_name]; // } else{ // return $default; // } // } // $name = getStuff("name", "no value"); // echo 'name is ' . $name; ############# USE THIS FOR $_GET issets on all PHP projects!!!################################### function myJoin($glue, $pieces) { $output = ''; foreach ($pieces as $idx => $piece) { if ($idx > 0) { $output .= $glue; } $output .= $piece; } return $output; } $a = ["cat", "dog", "rat"]; echo myJoin(':', $a);
function body_class($class) { // Separates classes with a single space, collates classes for body element echo 'class="' . myJoin(' ', get_body_class($class)) . '"'; return null; }