|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Strip URLs from a Multi-dimensional array
I'm having some trouble with a function I have setup that pulls URLs out of a database and displays them in a table.
The problem is that some URLs may be entered with "http://" and some may not be... So what I've setup is a way to strip out any occurrences of "http://" from the URLs that have been entered that way, and then just add "http://" to ALL the urls.... It may seem backward, so if anyone knows a better way, let me know... That's not the problem... The problem is that rather than stripping everything out during each iteration, I want to call a function that passes the array containing the URLs, do it's work, and return the URLs with the "http://" prefix. Any help is appreciated.
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#2
|
|||
|
|||
|
Hi Frank,
Here's an example: (!! EDITED !!) PHP Code:
I'm not that good with expressions, but this will iterate through and array and check if there's http:// in the beginning of the string. If there isn't, it will add it.
__________________
Best Regards, Håvard Lindset Last edited by Lindset : July 7th, 2002 at 05:03 PM. |
|
#3
|
|||
|
|||
|
Thank you!
i managed to get it working: PHP Code:
And here's the function: PHP Code:
Works like a charm! Thanks again! |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Strip URLs from a Multi-dimensional array |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|