0

I have following pattern in php:

products/546/orders

The number part will be dynamic. I have to find that pattern in following string.

user/proxy/products/546/orders/?cookie=admin

Any help will be appreciated!

Clay
  • 4,700
  • 3
  • 33
  • 49
Kishor Mishra
  • 75
  • 3
  • 11

1 Answers1

1

Use this to extract the number from the string

preg_match('~products/(\d+)/orders~', $yourUrl, $matches)
Clay
  • 4,700
  • 3
  • 33
  • 49