How to replace multiple tabs with a one space in PHP

1 Answer

0 votes
$s = "  PHP is    general-purpose      scripting language 
      that is especially    suited to web development.";
 
$s = preg_replace('/\t+/', ' ', $s);
 
echo $s;
 
 
/*
run:
  
PHP is general-purpose scripting language that is especially suited to web development.
  
*/

 



answered Jul 29, 2020 by avibootz
...