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 -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -