0

Say I have the following URL:

http://example.com/safety-checks/?carid=63&interval=2

And am getting the current url by doing

$current_url = $_SERVER['REQUEST_URI'];

How would I go about stripping the &interval=# but leaving the carid value?

1

1 Answer 1

1

Try explode

This should return up to the carid. The ampersand and everything following it is removed. $noInterval = explode("&", $current_url)[0]

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.