Advertisement
firoze

word Separating and controlling them

Jun 30th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.36 KB | None | 0 0
  1. <?php
  2.  
  3. // your code goes here
  4.  
  5. $title = "almigty";
  6.  
  7. $array_title = str_split($title);
  8.  
  9. $part1 = $array_title['0'].$array_title['1'];
  10.  
  11. $count = count($array_title);
  12.  
  13. $part3 = $array_title[$count-2].$array_title[$count-1];
  14.  
  15. $part2 = str_replace($part3, '', str_replace($part1, '', $title));
  16.  
  17. echo $part1."<span style='color:red'>$part2</span>".$part3;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement