📝 PHP Programming Questions for Interviews & Practice
1. Reverse a String in PHP
Question: Reverse the string programming using PHP.
Example 1:
$string = 'programming';
echo strrev($string);Example 2:
<?php
$string = 'programming';
$result = '';
// Calculate string length
$len =0;
while(isset($string[$len])){
$len++;
}
for($i = $len - 1; $i >= 0; $i--){
$result.= $string[$i];
}
echo 'Result: '.$result;1. Reverse a String in PHP
Question: Reverse the string programming using PHP.