fork download
  1. <?php
  2. $a='Elvis';
  3. $b='Chidera';
  4. $al=strlen($a);
  5. $bl=strlen($b);
  6. $diff=$bl-$al;
  7. $offset=abs($diff);
  8. if($diff>0) {
  9. $twil=$b;
  10. $lite=$a;
  11. }
  12. else {
  13. $twil=$a;
  14. $lite=$b;
  15. }
  16. $tl=strlen($twil);
  17. $l=strlen($lite);
  18. ($tl>$l)?$part1=substr
  19. ($twil,0,$offset-1):$part1='';
  20. ($tl>$l)?$mix1=substr
  21. ($twil,$offset-1,$tl-1):
  22. $mix1=$twil;
  23. $mix1=explode($mix1,'');
  24. $mix2=explode($lite,'');
  25. $mix='';
  26. for($i=0;$i<$l;$i++){
  27. $mix.=$mix1[$i].$mix2[$i];
  28. }
  29. $answer=$part1.$mix;
  30. echo "string1= $a";
  31. echo "string2= $b";
  32. echo $answer;
  33. ?>
Success #stdin #stdout #stderr 0.01s 20568KB
stdin
Standard input is empty
stdout
string1= Elvisstring2= ChideraC
stderr
PHP Notice:  Undefined offset: 1 in /home/xHEYYe/prog.php on line 27
PHP Notice:  Undefined offset: 1 in /home/xHEYYe/prog.php on line 27
PHP Notice:  Undefined offset: 2 in /home/xHEYYe/prog.php on line 27
PHP Notice:  Undefined offset: 2 in /home/xHEYYe/prog.php on line 27
PHP Notice:  Undefined offset: 3 in /home/xHEYYe/prog.php on line 27
PHP Notice:  Undefined offset: 3 in /home/xHEYYe/prog.php on line 27
PHP Notice:  Undefined offset: 4 in /home/xHEYYe/prog.php on line 27
PHP Notice:  Undefined offset: 4 in /home/xHEYYe/prog.php on line 27