Jump to content

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

}

 

 

flexibility and uniformity

 

basicy the loop is populating the array with data from the application  but some applications might not have the same variables

 

once array it processed it will then be set off to a payment gate way

 

 

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

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