Jump to content

does this conform with standard and will it break


pcmad

Recommended Posts

i am trying to build a payment gate way library do you think this is the best way of going about it

 

requirements

code to be flexible for different naming conventions

to conform with standards

not to break

 

why i am thinking of doing it this way

one application  could have for addressline1 as add_1 while i different app will have it as add_line_1

 

$test2 = "yay"; 
$test = 'a:1:{s:6:"teatme";s:5:"test2";}'; // think of this a a db field 
$test = unserialize($test);
echo"<pre style=\"text-align:left;\">";
print_r($test);
echo"</pre>";
foreach ($test as $key => $value)
{
    $test[$key] = $$value; 
}
echo"<pre style=\"text-align:left;\">";
print_r($test);
echo"</pre>";

please give us your thoughts

 

no that wont work because

 

the that values and variables that will be stored back into the array eg

 

$test2 = "yay";

 

foreach

{

      $test[$key] = $$value;

becomes

      $test[$key] = $test2;

becomes

      $test[$key] = "yay";

}

 

 

i think i understand. the field names are stored in the database and the loop set's the variable names and values based on the stored variable names. i haven't had to program anything like this, so i have no opinion on the method except "it looks fine to me."

no that wont work because

 

the that values and variables that will be stored back into the array

 

You don't need to store it back into the array. The array will still be intact after you looped over it ;) So like BlueSkyIS showed extract will be fine.

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.