fork(2) download
  1. <?php
  2.  
  3.  
  4. $text = "zxcvbnmnbvcxz";
  5.  
  6. $noSpaces = str_replace(" ", "", $text);
  7. $toLower = mb_strtolower($noSpaces);
  8.  
  9. $length = mb_strlen($toLower);
  10. $half = floor($length / 2);
  11.  
  12. for($i=0; $i<=$half; $i++){
  13. $sSymbol = mb_substr($toLower, $i, 1);
  14. $eSymbol = mb_substr($toLower, $length-1-$i, 1);
  15. echo "{$sSymbol}\t {$eSymbol}\t {$i}\t {-$i}\n";
  16. }
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
z	 z	 0	 {-0}
x	 x	 1	 {-1}
c	 c	 2	 {-2}
v	 v	 3	 {-3}
b	 b	 4	 {-4}
n	 n	 5	 {-5}
m	 m	 6	 {-6}