Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

get characters using strtok

Using strtok, how can I display everything before the first full stop in my string?
0
studio1090
Asked:
studio1090
1 Solution
 
Jeff DarlingDeveloper AnalystCommented:

$str = "Everthing before the full stop. I do not want to see this stuff.";
$token = ".";
 
echo  strtok ( $str , $token )

Open in new window

0
 
Ray PaseurCommented:
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
 
studio1090Author Commented:
Thank you for your help, and thank you for the heads up Ray
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now