maddogandnoriko Posted June 8, 2009 Share Posted June 8, 2009 I am writing a script that converts php pages to html pages for mobile devices with no net connection. I have an multi-dimensional array of urls and their replacement values: $links=array($phpURL,$fixedURL); Can I break this into two arrays, one containing all $phpURL's and another array containing all $fixedURL's? Here is what I am ultimately trying to do, if there is a cleaner way of doing it by all meansplease let me know. $text=str_replace($phpURLarray, $fixedURLarray, $text); Thank you once again for rescuing me from myself, Todd Link to comment https://forums.phpfreaks.com/topic/161380-split-array-into-two-arrays/ Share on other sites More sharing options...
Adam Posted June 8, 2009 Share Posted June 8, 2009 Give this a bash... foreach ($links as $key => $link) { $phpURLs[$key] = $link[0]; $fixedURLs[$key] = $link[1]; } Link to comment https://forums.phpfreaks.com/topic/161380-split-array-into-two-arrays/#findComment-851652 Share on other sites More sharing options...
Ken2k7 Posted June 8, 2009 Share Posted June 8, 2009 $links[0] would be $phpURL $links[1] would be $fixedURL You mean that? Link to comment https://forums.phpfreaks.com/topic/161380-split-array-into-two-arrays/#findComment-851653 Share on other sites More sharing options...
Adam Posted June 8, 2009 Share Posted June 8, 2009 I think "$links=array($phpURL,$fixedURL);" was just illustrating his multi-dimensional array? Link to comment https://forums.phpfreaks.com/topic/161380-split-array-into-two-arrays/#findComment-851656 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.