2009-05-27 11 views

Répondre

7

Vous devez utiliser preg_match_all() pour que:

preg_match_all('/#(\S+)/', $str, $matches, PREG_PATTERN_ORDER); 
$matches = $matches[1]; 
0
$string = "#wefwe dcdfg qwe #wef"; 
preg_match_all('/#(\w+)/', $string, $matches); 
var_dump($matches); 
array(2) { 
    [0]=> 
    array(2) { 
    [0]=> 
    string(6) "#wefwe" 
    [1]=> 
    string(4) "#wef" 
    } 
    [1]=> 
    array(2) { 
    [0]=> 
    string(5) "wefwe" 
    [1]=> 
    string(3) "wef" 
    } 
} 

C'est une façon de le faire :-)

Questions connexes