Jump to content

albertdumb

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

albertdumb's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have worked it out and it wasnt as complicated as i thought. Found the implode function. Heres the code i use foreach ($this->listSort as $value => $var){ $spiltVar= implode("','",$var); print 'g_routes[\''.$value.'\']= new Array(\''.$spiltVar .'\');'; } Thanks very much for your help tho.
  2. Thanks Lumio.. But the problem with that code is that the araay which is created has every key value iterated like so: g_routes['ACE'][0] = "BHX"; g_routes['ACE'][1] = "LGW"; g_routes['ACE'][2] = "LTN"; g_routes['ACE'][3] = "MAN"; But i want it like: g_routes['ACE'] = new Array('BHX','LGW','LTN','MAN'); i just dont know how to loop through the last dimension of the array and list it comma seperated, if you know what i mean.
  3. I am using a foreach and i got most it done except the last bit of the array: This is my code>> foreach ($listSort as $value => $var){ print 'g_routes[\''.$value.'\']= new Array(\''.$var[0] .'\',\'LGW\');'; } I am having problem with the new array as i need to loop trough to get the next level down but i am not sure how to do it. So this is what i have now: g_routes['ABZ']= new Array(' STILL NEED TO GET','STILL NEED TO GET'); Any help?
  4. Hi All. I have this array like so.... Array ( [ABZ] => Array ( [0] => AGP ) [ACE] => Array ( [0] => BHX [1] => LGW [2] => LTN [3] => MAN ) ) Now i want to loop through this array to print out a javascript array in the format like >> g_routes['ACE'] = new Array('BHX','LGW','LTN','MAN'); I dont mind just using an echo or assign it a php variable. Can anyone please help? Cheers
  5. Cheers dude. See why you are a super Guru.
  6. Hi all, i need help to rearrange a multidimensional array. I have an array like this:> Array ( [1] => Array ( [dep_airport] => ACE [arr_airport] => BHX ) [2] => Array ( [dep_airport] => ACE [arr_airport] => LGW ) Now i want to sort this array into a new array so that, if a dep_airport has the same value - list all the arr_airport as a value and dep_airport as a key like so: array( [ACE] => Array ( [0]=>BHX [1]=>LGW ) Can someone please help??? Cheers
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.