Jump to content
Sign in to follow this  

PHP strtok

Recommended Posts

The PHP function strtok splits a string one by one.

In the example below I’m trying to split off everything after the ? in the URL.


In PHP I was able to do this with the following:

$facebookURL = 'https://www.facebook.com/LiquidWebInc?fref=ts';
$cocacolaURL = 'https://www.facebook.com/CocaColaUnitedStates?brand_redir=1';

$facebookURL = strtok($facebookURL, '?');
$cocacolaURL = strtok($cocacolaURL, '?');

Check out the demo here.

The post PHP strtok appeared first on Kansas City Web Consulting | Kansas City Web Development.

View the full article

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this