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
Post a Comment