i have a text line " as title: news words:500 body: this is a great day
now i want the it be broken into such that 3 parts with the variables holding the data as follows
$title = news
$words = 500
$body = this is a great day
how can i get that? i m trying explode implode but not working here's my code
now i want the it be broken into such that 3 parts with the variables holding the data as follows
$title = news
$words = 500
$body = this is a great day
how can i get that? i m trying explode implode but not working here's my code
Code:
<?php
$first = array();
$string = "title: news words:500 body: this is a great day ";
$sep1 ="title: ";
$sep2 ="words: ";
$sep3 ="body: ";
$first[0] = explode($sep2, $string);
$string0 = implode("",$first[0]);
$title = $string0;
echo $title;
?>
Comment