I'm fetching a clean url from my application which all look like:
Code: Select all
http://domain.com/this-page/[id]-this-is-a-clean-url/I only want that id
In php the code will look like:
Code: Select all
//...stuff happens before this
// clean up url, prevent malicious code
$page_action = preg_replace('/[^a-zA-Z0-9-_\_]/', '', $_GET['action']);
// now $page_action == [id]-this-is-a-clean-url
// and I only want the [id] part, which is always an integer
So delete everything after the first occurence of -