paganotti
paganotti

Reputation: 5661

how extract word from text in php

How can I extract word from text in php? or example, I have this string: this is a long text string where it is written something

I want obtain:

this
is
long
text
string
where
it 
is written
something

Upvotes: 0

Views: 3430

Answers (2)

Zuber Surya
Zuber Surya

Reputation: 869

you can try builtin function explode

$string='this is a long text string where it is written something';
$output = explode(" ", $string);
var_dump($output);

it will show your required result

Upvotes: 0

Rick Su
Rick Su

Reputation: 16440

Take a look at the PHP manual explode

http://php.net/manual/en/function.explode.php

explode by space ' ' would get the result you want.

Upvotes: 2

Related Questions