title: PHP split to preg_split()
body: <p>I wanted to convert the following split function, which I have been using to preg_split.. it's a little confusing, because the value will change from time to time...</p>
  
  <p>Current code:</p>
  
  <pre><code>$root_dir = 'www';
  $current_dir = 'D:/Projects/job.com/www/www/path/source';
  $array = split('www', 'D:/Projects/job.com/www/www/path/source', 2);
  print_r($array);
  </code></pre>
  
  <p>Output of the split function:</p>
  
  <pre><code>Array ( [0] =&gt; D:/Projects/job.com/ [1] =&gt; /www/path/source )
  </code></pre>