Jump to content

Fetching last characters after "=" sign


Go to solution Solved by .josh,

Recommended Posts

One thread for a question. Just one thread. Don't need to post three of them in different forums.

 

So you're in the index.php script and want to get the "new" from the URL? $_GET

echo $_GET["site"];
If you're not sure the "site=next" is even present in the URL, which it might not be, then use isset to check if it is before you try to use it.

if (isset($_GET["site"])) {
	$site = $_GET["site"];
	// ...
} else {
	// wasn't given
}
Link to comment
Share on other sites

One thread for a question. Just one thread. Don't need to post three of them in different forums.

 

So you're in the index.php script and want to get the "new" from the URL? $_GET

echo $_GET["site"];
If you're not sure the "site=next" is even present in the URL, which it might not be, then use isset to check if it is before you try to use it.

if (isset($_GET["site"])) {
	$site = $_GET["site"];
	// ...
} else {
	// wasn't given
}

No no, actually, http://www.abc.com/index.php?site=new ... is a single string, i want to explode this... I want to devide this in two parts... breaking through "=" sign

Link to comment
Share on other sites

Or, if you ONLY need the text after the equal sign and don't need the part before, you can use strpos() and substr()

$value = substr($input, strpos($input, '='));

Although, you could also just use strrchr(), but that would include the equal sign in the result and require another step as well.

this includes "=" sign, which i don't want

 

anyway many thanks for your answer

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.