Jump to content
php.lv forumi

preg_match_all


anonīms

Recommended Posts

http://paste.php.lv/7e97a951effe899dc3fd2e734f5b508f/nonum

 

Kāpēc man tiek atgriezts tikai 1 rezultāts? tb atsauce (bez 1), netiek atgriezta) 

 

 

 

 

Array(    [0] => Array        (            [0] => [TOOLTIP]atsauce1[TEXT]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam consectetur posuere tellus[/TEXT][/TOOLTIP] sit amet, consectetur adipiscing elit. Nam consectetur posuere tellus, sit amet tempor augue tempus vel. Mauris nec imperdiet mauris. Sed pharetra blandit justo at auctor. Quisque non laoreet sem. [TOOLTIP]atsauce[TEXT]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam consectetur posuere tellus[/TEXT][/TOOLTIP]        )    [1] => Array        (            [0] => atsauce1[TEXT]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam consectetur posuere tellus[/TEXT][/TOOLTIP] sit amet, consectetur adipiscing elit. Nam consectetur posuere tellus, sit amet tempor augue tempus vel. Mauris nec imperdiet mauris. Sed pharetra blandit justo at auctor. Quisque non laoreet sem. [TOOLTIP]atsauce[TEXT]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam consectetur posuere tellus[/TEXT]        ))

 

Link to comment
Share on other sites

<?php

$text = 'Lorem dolor [TOOLTIP]atsauce1[TEXT]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam consectetur posuere tellus[/TEXT][/TOOLTIP] sit amet, consectetur adipiscing elit. Nam consectetur posuere tellus, sit amet tempor augue tempus vel. Mauris nec imperdiet mauris. Sed pharetra blandit justo at auctor. Quisque non laoreet sem. [TOOLTIP]atsauce[TEXT]Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam consectetur posuere tellus[/TEXT][/TOOLTIP]';
preg_match_all("/\[TOOLTIP\](.*?)\[\/TOOLTIP\]/", $text, $matches);
 
print '<pre>';
print_r($matches);
print '</pre>';

?>

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...