We launched new forums in March 2019—
join us there
.
In a hurry for help with your website?
Get Help Now!
Back to MODX.com
Forums
Docs
Revo Issues
Blog
My Forums
General
General Support
Search
Howto get the first word in a comma separated string
92 Posts
ichris89
Reply #1,
8 years, 11 months ago
Hi,
I have a TV with contents a comma separated string, e.g.: Hello, World, this, contains, many, words
How can I return the first word?
24,544 Posts
BobRay
Reply #2,
8 years, 11 months ago
$firstWord = reset(explode(',', $string));
or
$firstWord = strtok($string, ',');
Did I help you?
Buy me a beer
Get my Book:
MODX:The Official Guide
MODX info for everyone:
http://bobsguides.com/modx.html
My MODX Extras
Bob's Guides is now hosted at
A2 MODX Hosting