preg replace - preg_replace match times variable php -


following idea

$aufnahme = "annaberg";  $i="2";  $zwei=preg_replace("/\a.{"$i"}/", ' ', $aufnahme); 

it should remove number of variable $i, of the beginning word

means $i="2" //shows "naberg"

how can it?

you're pretty close, syntax off:

$aufnahme = "annaberg";  $i="2";  $zwei=preg_replace("/\a.{".$i."}/", ' ', $aufnahme); echo $zwei; 

if want replace first $i characters, substr($aufnahme, $i);


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -