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
Solved

get characters using strtok

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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 …

792 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