I would like to know if some word is present in the URL.
For example, if word car is in the URL, like www.domain.com/car/ or www.domain.com/car/audi/ it would echo 'car is exist' and if there's nothing it would echo 'no cars'.
I would like to know if some word is present in the URL.
For example, if word car is in the URL, like www.domain.com/car/ or www.domain.com/car/audi/ it would echo 'car is exist' and if there's nothing it would echo 'no cars'.
you can use this function as this code sir
worked for me with php
Have a look at the strpos function:
The URL parameters and received from a global variable called
$_GET
which is in fact an array. So, to know if a URL contains a parameter, you can use theisset()
function.Afterwards, you can create separate array of such parameter you need to attach to a URL.
For example:
Now, to know whether or not, you need a
?
symbol, just count this arrayUpdate:
To know if any parameter is set, just count the $_GET
See
strpos
manual