lordphate Posted February 19, 2009 Share Posted February 19, 2009 Hey everyone, i'm having some issues here.. The following code is where i want to use the explode to enter new titles into the theme titles. $titles_explode = explode(" -: : | : : - ",file_get_contents("data/titles.inc.php")); foreach($titles_explode as $title) { $data = explode("___",$title); $titles_file = DOC_ROOT."/themes/".$theme."/titles.inc.php"; include($titles_file); $title_str = "<?php "; $title_str .= go_through_array("\$titles",$titles); $title_str .= '$titles["'.$title[0].'"] = "'.$title[1].'";'; $title_str .= '?>'; $file_handler = fopen($titles_file,"w"); fwrite($file_handler,$title_str); fclose($file_handler); }//foreach_titles here is whats in data/titles.inc.php files-: : | : : -|site_name|::Files___ files_upload-: : | : : -site_name|::Files Upload___ files_edit-: : | : : -site_name|::Files Edit___ files_manage-: : | : : -site_name|::Files Manage___ files_view-: : | : : -|site_name|::Files View and heres' what its outputting [after the go_through_array function is where its messing up] $titles["files-: : | : : -|site_name|::Files"] = " files_upload-: : | : : -site_name|::Files Upload"; $titles[" "] = " "; $titles["f"] = "i"; Link to comment https://forums.phpfreaks.com/topic/146034-explode-foreach-arg/ Share on other sites More sharing options...
samshel Posted February 20, 2009 Share Posted February 20, 2009 i think you should explode first by "___" and then in the loop by " -: : | : : - " Link to comment https://forums.phpfreaks.com/topic/146034-explode-foreach-arg/#findComment-766688 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.