开发者

Preg_match with regular expressions?

开发者 https://www.devze.com 2023-04-05 12:27 出处:网络
Im trying to catch a posted variable with name that begins with \'price\' and ends开发者_StackOverflow with a number 0-9 and save the number in a variable $matches. For some reason, the code i have is

Im trying to catch a posted variable with name that begins with 'price' and ends开发者_StackOverflow with a number 0-9 and save the number in a variable $matches. For some reason, the code i have isnt catching it, so obviously my syntax is off. Heres my code..

elseif (preg_match('price/[1-9]/', $field_name, $matches)) {


preg_match('/^price([0-9])$/', $field_name, $matches)

The $matches[1] will give you the number.

0

精彩评论

暂无评论...
验证码 换一张
取 消