Some time ago during a job interview I got the task to reverse a string in PHP without using strrev.
strrev
My first solution was something like this:
This is my solution to solve this.
$in = 'This is a test text'; $out = ''; // find string length $len = strlen($in); // loop through it and print it reverse for ( $i = $len - 1; $i >=0;$i-- ) { $out = $out.$in[$i]; } echo $out;