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

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

dataset - MPAndroidchart returning no chart Data available -

post - imageshack API cURL -