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
Post a Comment