In JavaScript, we have the function test()
, for example:
/Test \[(\d+)\]/gi.test(string); // Pode retornar true ou false.
Does php have a similar function?
In JavaScript, we have the function test()
, for example:
/Test \[(\d+)\]/gi.test(string); // Pode retornar true ou false.
Does php have a similar function?
Yes. In PHP
you can use preg_match
if ( preg_match("/[\d]+/", $value) ) {
/* Code Here */
}