Solved

get characters using strtok

Posted on 2008-10-20
3
201 Views
Last Modified: 2012-06-21
Using strtok, how can I display everything before the first full stop in my string?
0
Comment
Question by:studio1090
3 Comments
 
LVL 12

Accepted Solution

by:
Jeff Darling earned 125 total points
ID: 22759846

$str = "Everthing before the full stop. I do not want to see this stuff.";

$token = ".";
 

echo  strtok ( $str , $token )

Open in new window

0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 22761425
The same effect can be accomplished with explode() and strpos() + substr()

More docs on strtok here:
http://us3.php.net/manual/en/function.strtok.php

Best regards, ~Ray
0
 

Author Comment

by:studio1090
ID: 22765142
Thank you for your help, and thank you for the heads up Ray
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now