Как да разделя Тагове

vik96

Registered
Здравейте. Как да разделя примерно :
Код:
<code> asdsad as </code>  <code>vik96</code> <code> user</code>
на масив който да е така :

Код:
array("<code> asdsad as </code> ","<code>vik96</code>","<code> user</code>");
примерно?
 
Код:
<?php
$text = "SOme text here<code> asdsad as </code>, and here some text  <code>vik96</code> here too <code> user</code>";
preg_match_all("/(<code>.*?<\/code>)/", $text, $matches);
print_r($matches[0]);
?>
 
Това:
<?
$text = "SOme text here<code> asdsad as </code>, and here some text <code>vik96</code>

here too <code> user</code>";
preg_match_all("/(<code>.*?<\/code>)/", $text, $matches);
echo $matches[0];
?>
извежда :

а трябва да извежда : asdsad as
 
Просто ги превърташ през един цикъл
Код:
for($i = 0;$i <= count($matches);$i++) {
echo $matches[0][$i]."<br />";
}
 
Нестава, примерно виж :

<?
$text = "SOme text here<code> asdsad as </code>, and here some text <code>vik96</code>

here too <code> user</code>";
preg_match_all("/(<code>.*?<\/code>)/", $text, $matches);
foreach ( $matches as $value )
{
echo $value;
}
?>


На това изкарва АrrayArray
 
<?
$text = "SOme text here<code> asdsad as </code>, and here some text <code>vik96</code>

here too <code> user</code>";
preg_match_all("/(<code>(.*?)<\/code>)/", $text, $matches);
foreach ( $matches[1] as $value )
{
echo $value;
}
?>
 
Вие дадохте една точка за support на MontefuckeR .
Натиснете тук за да се върнете в темата.
 

Горе