Hi all,
I am still very new to PHP, so I need all the help I can get here. I am looking to do the following:
function tid_value($string1, $string2) //String 1 and String 2 are long strings containing | symbols as a break point between words (like a .csv)
{
Take String 1, and take out each value from it, and place it in an array called "countries".
e.g String1 = "UK|EU|NON EU|US"
Countries=
UK
EU
NON EU
US
And then do the same for string 2 to a "sub_section" array. Both these strings can very in length from one value to 6.
Then for the arrays I want to do the following:
For each item in the Countries array
{
For each item in the sub_section array
{
Take the value of the Countries array being pointed too
Take the value of the sub_section array being pointed too
Concatenate both values together
}
}
}
Does anyone know of a way to do the above? I expect its pretty simple. My biggest headache is splitting the values from the string when a | is read.
Kind Regards
Tom Noble
String Manipulation and Arrays
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: String Manipulation and Arrays
Code: Select all
explode()mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.