daily pastebin goal
53%
SHARE
TWEET

Invertendo String e retornando a Segunda Maiuscúla

jeffersonjulio Feb 4th, 2016 (edited) 124 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    function inverte_caracteree_muda_segunda_maiuscula($str){
  2.         $ct_str     = strlen($str);
  3.         $n_str      = null;
  4.         $n_str_r    = null;
  5.         for($i = $ct_str; $i >= 0; $i--){
  6.             $n_str .= $str[$i];
  7.         }
  8.         for($i = 0; $i <= $ct_str; $i++){
  9.             $quebra_indice = $i + 1;
  10.             $n_str_r .= ($quebra_indice % 2 == 0) ? strtoupper($n_str[$i]) : strtolower($n_str[$i]);
  11.         }
  12.         return $n_str_r;
  13.     }
  14.     echo inverte_caracteree_muda_segunda_maiuscula("Jefferson Julio :D");
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top