Jump to content

array_replace()


dreamwest
 Share

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
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;

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

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