How do I include variable between {} brackets in a php preg_match? -


so have php code

preg_match('/^([^.!?]*[\.!?]+){0,**3**}/', $text, $abstract); 

instead of number 3 variable example >

preg_match('/^([^.!?]*[\.!?]+){0,**$variable**}/', $text, $abstract); 

please lot :)

use double quotes instead of single quotes, , variable substituted:

preg_match("/^([^.!?]*[\.!?]+){0,$variable}/", $text, $abstract); 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -