Schlo_50 Posted June 3, 2008 Share Posted June 3, 2008 Hi again, I managed to get together this script with the help from the guys here earlier but I am in need of some more help. I have put some strings into an array and now need to separate each string by commas but my implode isnt working. Could someone take a look please? $arrString = array(); $arrString[] = $relevanta; $arrString[] = $relevantb; $arrString[] = $relevantc; $arrString[] = $relevantd; $arrString[] = $relevante; $arrString[] = $relevantf; foreach ($arrString as $v) { if (!is_null($v)) { $srt_string = implode(",", $v); } } Thanks Link to comment https://forums.phpfreaks.com/topic/108527-solved-comma-separating/ Share on other sites More sharing options...
samshel Posted June 3, 2008 Share Posted June 3, 2008 Try this, and check if this is what you need $arrString = array(); if(!is_null($relevanta)) $arrString[] = $relevanta; if(!is_null($relevantb)) $arrString[] = $relevantb; if(!is_null($relevantc)) $arrString[] = $relevantc; if(!is_null($relevantd)) $arrString[] = $relevantd; if(!is_null($relevante)) $arrString[] = $relevante; if(!is_null($relevantf)) $arrString[] = $relevantf; $srt_string = implode(",", $arrString); Link to comment https://forums.phpfreaks.com/topic/108527-solved-comma-separating/#findComment-556461 Share on other sites More sharing options...
Schlo_50 Posted June 3, 2008 Author Share Posted June 3, 2008 Bang on matey! Thanks. Thats just wat I was looking for, I thought your method from the start was the better of the two given. (Future is, indeed Linux) Link to comment https://forums.phpfreaks.com/topic/108527-solved-comma-separating/#findComment-556464 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.