<?php $string = "/companies/(?)/adverts/new/(?)"; $replace = array(2223, 'generic'); $result = preg_replace_callback('#(\(\?\))#', function($m) use ($replace) { static $i=0; return $replace[$i++]; }, $string); var_dump($result);
You have javascript disabled. You will not be able to edit any code.