Jump to content

select first 20 char and insert


fer0an

Recommended Posts

I've same as this title :

PaaS-Platform-and-Storage-Management-Specialist-Level-Complete-Certification-Kit-Platform-as-a-Service-Study

I want select first 5 word that's seprated by "-".

 

any solution?

 

$pieces = explode("-", $string);

echo "$pieces[0]";

 

o/p

PaaS

 

for five

echo "$pieces[0]-$pieces[1]-$pieces[2]-$pieces[3]-$pieces[4]-$pieces[5]";

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.