title: Replace specific space with non-breakable space in PHP
body: <p>I'm a complete beginner when it comes to coding with php and its my first time posting to stackoverflow. I'm having some problems with my code. I'm trying to search through a string for a number followed by a space followed by another number and replace the space with a non-breakable space. I know I need to use regex, but I still can't figure it out. Any help would be greatly appreciated. My code is: </p>
  
  <pre><code>echo replaceSpace("hello world ! 1 234");
  function replaceSpace( $text ){        
     $brokenspace = array(" !", " ?", " ;", " :", " …", "« ", " »", "( ", " )");
     $fixedspace = array("&amp;nbsp;!", "&amp;nbsp;?", "&amp;nbsp;;", "&amp;nbsp;:", "&amp;nbsp;»", "&amp;nbsp;…", "«&amp;nbsp;", "(&amp;nbsp;", "&amp;nbsp;)");
  
     return str_replace( $brokenspace , $fixedspace, $text );            
  }
  </code></pre>
  
  <p>I want my output to be:</p>
  
  <blockquote>
    <p>hello world(nbsp)! 1(nbsp)234</p>
  </blockquote>