Solved

get characters using strtok

Posted on 2008-10-20
3
263 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 13

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

695 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