Solved

get characters using strtok

Posted on 2008-10-20
3
252 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 110

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses how to implement server side field validation and display customized error messages to the client.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

749 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