iversonm Posted September 23, 2008 Share Posted September 23, 2008 so if i pull data from a database and use $array=explode("\n", $log); // and the array would equal this$array=array('this is the first', 'this is the second', 'this is the third', 'those are all lines'); so lets say i want to update the array i know that if i wanted to add a new row i would just do this $newlog="this is a new line\n".$oldlog; right ok so that works fine, but lets say i want to use $array and update the first line so lets say i want to make the first row this $array[0]="this is the new first row"; but i want all the past things from $array to stay the same how would i do this? Link to comment https://forums.phpfreaks.com/topic/125400-updating-field/ Share on other sites More sharing options...
xtopolis Posted September 23, 2008 Share Posted September 23, 2008 array_merge http://us2.php.net/manual/en/function.array-merge.php ex: <?php $a = array("one","two","three"); $b = array("new one"); $c = array_merge($b,$a); print_r($c); // output is: //Array ( [0] => new one [1] => one [2] => two [3] => three ) ?> Link to comment https://forums.phpfreaks.com/topic/125400-updating-field/#findComment-648369 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.