Reputation: 5661
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
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
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