after explode how i can implode $data=file_get_contents('http://www.webtjax.com/test.txt'); /////**************************************************** $line_title=explode('true);" title="',$data); unset ($line_title[0]); foreach($line_title as $part) { $line_title_temp=explode('">',$part); echo $line_title_temp[0].'<br />' ; } PHP: Result ///// Webmaster-1 Webmaster-2 Webmaster-3 Webmaster-4 Webmaster-5 Webmaster-6 Webmaster-7 Webmaster-8 Webmaster-9 Webmaster-10 now i want this type of result $a=Webmaster-1,Webmaster-2,Webmaster-3,Webmaster-4,Webmaster-5,Webmaster-6,Webmaster-7,Webmaster-8,Webmaster-9,Webmaster-10 Please tell me how it is possible ?
$arr = array(); $data=file_get_contents('http://www.webtjax.com/test.txt'); /////**************************************************** $line_title=explode('true);" title="',$data); unset ($line_title[0]); foreach($line_title as $part) { $line_title_temp=explode('">',$part); $arr[] = $line_title_temp[0]; } $a = implode(',',$arr); echo $a; PHP:
Just replace "</ br>" with "," $data=file_get_contents('http://www.webtjax.com/test.txt'); /////**************************************************** $line_title=explode('true);" title="',$data); unset ($line_title[0]); foreach($line_title as $part) { $line_title_temp=explode('">',$part); $a .= $line_title_temp[0].',' ; echo $a; } PHP:
ok but i have one question how i can convert into unique means if return is webmaster,webmaster,webmaster,developer,designer but i am getting this type of error when i used Warning: array_unique() [function.array-unique]: The argument should be an array in code.php on line 20
The argument in array_unique() must be an array. "webmaster,webmaster,webmaster,developer,designer" is a string. You must: $a = explode(',',$a); before use array_unique($a);
$arr = array(); $data=file_get_contents('http://www.webtjax.com/test.txt'); /////**************************************************** $line_title=explode('true);" title="',$data); unset ($line_title[0]); foreach($line_title as $part) { $line_title_temp=explode('">',$part); $arr[] = $line_title_temp[0]; } $a = implode(',',array_unique($arr)); echo $a; PHP: