Jump to content

array_replace()


dreamwest

Recommended Posts

Simple  array_replace()  but it throwing an error, can anyone see what ive done wrong?

 

while($row2 = mysql_fetch_assoc( $res2 )){
	  
		$title2 = "replace desc";

//$row2 prints array( l_desc => title )

$row2 = array_replace($row2, array('l_desc' => $title2));
print_r($row2);	

	  $show[] = $row2;
}//end while

 

Fatal error: Call to undefined function array_replace() in .....

 

Im using PHP 5+

Link to comment
https://forums.phpfreaks.com/topic/259035-array_replace/
Share on other sites

If your using strings for the keys and not numbers, which I assume you are since your using mysql_fetch_assoc, then array_merge should accomplish the same thing as array_replace.

 

I assume you have more than just that one column to replace?  If not you'd probably be ahead to just do $row2['l_desc']=$title2;

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.