There is probably a really simple way to do this, but I can't find it in the list of functions in PHP....
I've got a variable e.g. SO7567 and I want to break it down in three parts: SO, 75, 67 and then carry out actions on each part....
Is there an easy way of doing this? In fact, is there a way in PHP?
The variable in this case is always 6 chars long, and I always want it split into 3.
For those interested, SO7567 is a GB mapping reference, and I want to turn it into a true reference - which I can do....!
Breaking down variables
Moderator: General Moderators
If this is an array then just loop through using a foreach statement and check the name of the key.
I expect, however, that you're talking about global variables, if so you can use the get_defined_vars() function which will return an associative array of all defined variables. You can then simply loop through each value.
Kelvin
I expect, however, that you're talking about global variables, if so you can use the get_defined_vars() function which will return an associative array of all defined variables. You can then simply loop through each value.
Kelvin
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK