| Welcome to WebmasterWorld Guest from 184.108.40.206 |
register, login, search, subscribe, help, library, PubCon, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor|
|Replacing Values in Array|
| 12:52 pm on Jan 20, 2011 (gmt 0)|
I have an array called $names that outputs like this:
 => Array
[FULL_NAME] => Second, First
[LAST_NAME] => Second
[FIRST_NAME] => First
 => Array
[FULL_NAME] => Two, One
[LAST_NAME] => Two
[FIRST_NAME] => One
The sub-arrays in the example are just 2 but there can be many more.
Can anyone tell me how I can replace the value of all the FULL_NAME to display FIRST_NAME followed by LAST_NAME without a comma?
Any suggestions would be great
| 3:10 pm on Jan 20, 2011 (gmt 0)|
are you talking about something like this?
$names['FULL_NAME'] = $names['FIRST_NAME'].' '.$names['LAST_NAME']
You can easily loop in an array using something like:
foreach ($names as $custNames)
$custNames['FULL_NAME'] = $custNames['FIRST_NAME'].' '.$custNames['LAST_NAME'];
| 6:31 pm on Jan 20, 2011 (gmt 0)|
I'd say more like this...
$i = 1;
$mynames[$i]['FULL_NAME'] = $mynames[$i]['FIRST_NAME'] . $mynames[$i]['LAST_NAME'];
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld ® and PubCon ® are a Registered Trademarks of Pubcon Inc.
© Pubcon Inc. 1996-2012 all rights reserved