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 Quote 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]; } Quote 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? Quote 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? Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.