2012-06-06 90 views
0

如何從php中的文本中提取單詞? 或例子,我有這個字符串: this is a long text string where it is written something如何從php中的文本中提取單詞

我想獲得:

this 
is 
long 
text 
string 
where 
it 
is written 
something 
+2

是'被written'在一行只是一個錯字? – zerkms

+1

我假設你想在輸出中輸入'a'? –

回答

0

你可以試試內置函數explode

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

它會告訴你需要的結果