Как да взема подчертания substring

eLite

Registered
Здравейте всички! Чудя се как да взема подчертания substring в следния код с explode():
<div style='height:10px'><br /></div>
<div style='text-align:center'>The text</div>
<div style='height:10px'><br /></div>
 
Код:
<?php

$text = "<div style='height:10px'><br /></div>
<div style='text-align:center'>[u][b]The text[/b][/u]</div>
<div style='height:10px'><br /></div>";

$explode = explode('[b]',$text);
$explode1 = explode('[/b]',$explode[1]);

echo $explode1[0];

?>
 
Код:
<?php

$text = "
		<div style='height:10px'><br /></div>
		<div style='text-align:center'>The text</div>
		<div style='height:10px'><br /></div>";

$explode = explode('<div style=\'text-align:center\'>',$text);
$explode1 = explode('<',$explode[1]);

echo $explode1[0];

?>
 
Ето ти примерен код за разграничаване :


Код:
   <form method="POST" action="">
   Текста : <textarea name="text"></textarea>
   <input type="submit" name="submit" value="Давай">
   </form>
   
   <?
   if (isset($_POST['submit']))
   {
   $text=$_POST['text'];
   if (empty($text))
   {
   echo "Няма нищо въведено !";
   }
   else
   {
   $preg=preg_match('[u]', $text);
   if (!$preg)
   {
   echo "Няма подчертани !";
   }
   else
   {
   $f=explode("[u]", $text);
   $s=explode("[/u]", $f[1]);
   
   echo "Подчертания текст в текса е <b>$s[0]</b>";
   }
   }
   
   }
   ?>
 
t0m3kk каза:
Код:
<?php

$text = "
		<div style='height:10px'><br /></div>
		<div style='text-align:center'>The text</div>
		<div style='height:10px'><br /></div>";

$explode = explode('<div style=\'text-align:center\'>',$text);
$explode1 = explode('<',$explode[1]);

echo $explode1[0];

?>
Мдаа, +1 t0m3kk. :)
 

Back
Горе