Jump to content

[SOLVED] Apply function to all array


jaymc

Recommended Posts

just a quick one, I cant remember how to do this

 

I want to execute a function on every element in an array, but leave the result in the array

 

So instead of this

 

 

			$song_data[song_name] = mysql_real_escape_string($song_data[song_name]);
		$song_data[artist_name] = mysql_real_escape_string($song_data[artist_name]);
		$song_data[album_name] = mysql_real_escape_string($song_data[album_name]);
		$song_data[genre] = mysql_real_escape_string($song_data[genre]);
		$song_data[year] = mysql_real_escape_string($song_data[year]);
		$song_data[kbps] = mysql_real_escape_string($song_data[kbps]);

 

I could have something like

 

magic_function($song_data, mysql_real_escape_string());

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/102045-solved-apply-function-to-all-array/
Share on other sites

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.