preg_split () is similar to the old split () ereg function. You should only add the regex to /.../ as follows:
preg_split('/www/', 'D:/Projects/job.com/www/www/path/source', 2);
Nested slashes / here are indeed part of the regular expression syntax that does not execute in a string. If the www delimiter is a variable, you must additionally use preg_quote () for the inside.
But note that you don't need regular expressions if you look at static strings anyway. In such cases, you can use explode() in much the same way you used split ():
explode('www', 'D:/Projects/job.com/www/www/path/source', 2);
mario
source share