i want to break the word
for example

Health-and-Fitness:Weight-Loss
i ant to break into two parts
healt-and -fitness
and

weight-loss

weathei have to use str_split. if i use it is not spliting

any bodu please help me

Recommended Answers

All 2 Replies

What are the rules for the split, number of characters, the semi colon?

If it's the semi colon take a look at explode

Expanding on Sarahk's response:

$input = 'Health-and-Fitness:Weight-Loss';
list($category,$subcategory) = explode(':',$input);
/*
results:
echo $input => Health-and-Fitness:Weight-Loss
echo $category=> Health-and-Fitness
echo $subcategory=> Weight-Loss
*/
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.