...

View Full Version : Organizing/Shortening Different Variables With The Same Values



curb
03-18-2007, 01:19 AM
Is there a way I can organize or shorten the coding when I have multiple variables with the same values?

Example:


$temp_1 = "same value here";
$temp_2 = "same value here";
$temp_3 = "same value here";
$temp_4 = "same value here";
$temp_5 = "same value here";

Nightfire
03-18-2007, 01:21 AM
Will they always have the same values as eachother?

curb
03-18-2007, 01:29 AM
Yes. I didn't notice the extra problem. The problem is the only value that would be different would be the $temp_# inside the str_replace function.

Here's an example of what I have.


$temp_2 = str_replace("%title_description%", $_POST[title_description], $temp_2);
$temp_3 = str_replace("%title_description%", $_POST[title_description], $temp_3);
$temp_4 = str_replace("%title_description%", $_POST[title_description], $temp_4);
$temp_5 = str_replace("%title_description%", $_POST[title_description], $temp_5);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum