Using PHP how I can print a string reverse -


i want print string reversed. found code can't understand meaning of immediate 2 line after loop.

<?php      $s = 'abcdefg';     $j = 0;      ($i = strlen($s) - 1; $i >= 0; $i--) {        $s .= $s[$i];        $s[$i] = null;        $j++;     }     echo "$s";     echo "<br/>";     echo "there " . $j . " character in string."; ?> 

just use strrev

<?php echo strrev("abcdefg"); 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

post - imageshack API cURL -