I have this array:
array ('project'=>'My project','leader'=>'Michael Phepps','partner1'=>'John Campbell','partner2'=>'Phillip Prescott','agepartner1'=>25, 'agepartner2'=>'44', 'budget'=>'80000');
The array is the result of some queries in diferent tables:
project table fields: project, leader, budget.
partners fields: partner, age
The order of the array is defined by an user, and executed like this:
foreach ($userarray as $field) {loadField($field)};
As the operation is for each field I obtain ‘partner2’ after ‘partner1’ but I need to get ‘agepartner1’ after ‘partner1’, because them are displayed in a html table after that.
Any suggestions can I obtain:
array ('project'=>'My project','leader'=>'Michael Phepps','partner1'=>'John Campbell', 'agepartner1'=>25, 'partner2'=>'Phillip Prescott', 'agepartner2'=>'44', 'budget'=>'80000');
While perhaps not exactly the answer you’re looking for, I think there may be a better way to approach your situation:
Output:
So with your data: