Distinguish between text and pictures
There is a paragraph of text as follows, I want to use PHP to make the text part of the assignment to a variable, the picture description of the part to differentiate the assignment to a variable, how to implement the program?
Item Size/spec: 24 cm high, good stuff is worth collecting.
700? 700:true); "title=" 1.jpg "/>
700? 700:true); "title=" 2.jpg "/>
700? 700:true); "title=" 3.jpg "/>
------to solve the idea----------------------
Does the picture description part refer to each title? There's more than that.
------to solve the idea----------------------
$str 1 is a literal description
$str 2 is a picture description
$content =<<
<>
Item Size/spec: 24 cm high, good stuff is worth collecting.
700? 700:true); "title=" 1.jpg "/>
700? 700:true); "title=" 2.jpg "/>
700? 700:true); "title=" 3.jpg "/>
TXT;
$data = Explode ('', $content);
$str 1 = $data [0]. '
';
unset ($data [0]);
$str 2 = ''. Implode ('
', $data);
echo $str 1;
echo $str 2 ';
------to solve the idea----------------------
$s = 'Item Size/spec: 24 cm high, good stuff is worth collecting.
700? 700:true); "title=" 1.jpg "/>
700? 700:true); "title=" 2.jpg "/>
700? 700:true); "title=" 3.jpg "/>
';
Preg_match_all ('/[\x7f-\xff]+/', $s, $a);
$s 1=implode (", $a [0]);
Preg_match_all ('/title= ' (. *?) " /', $s, $b);
echo $s 1; Text section
Print_r ($b [1]); Picture description