fork(1) download
  1. <?php
  2. $var="< >< >Association football< >< >";
  3. $var=preg_replace('/[ ](?=[^<>]*(?:<|$))/', '&nbsp', $var);
  4.  
  5. echo $var;
Success #stdin #stdout 0.02s 13064KB
stdin
Standard input is empty
stdout
<  >< >Association&nbspfootball< ><  >