Solved

get characters using strtok

Posted on 2008-10-20
3
234 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 109

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP installation issues 11 61
Yet another array challenge. This time utilizing plupload image sorting from server. 17 53
Wordpress Taxonomy 2 28
Php recording post 4 45
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

777 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