Steps for the payment gateway processing?

An online payment gateway is the interface between your merchant account and your Web site. The online payment gateway allows you to immediately verify credit card transactions and authorize funds on a customer’s credit card directly from your Web site. It then passes the transaction off to your merchant bank for processing, commonly referred to as transaction batching

How to store the uploaded file to the final location?

move_uploaded_file ( string filename, string destination)

This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP’s HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by destination.

If filename is not a valid upload file, then no action will occur, and move_uploaded_file() will return FALSE.

If filename is a valid upload file, but cannot be moved for some reason, no action will occur, and move_uploaded_file() will return FALSE. Additionally, a warning will be issued.

What is type juggling in php?

PHP does not require (or it support) explicit type definition in variable declaration; a variable’s type is determined by the context in which the variable is used. That is to say, if a string value is assigned to variable $var, $var becomes a string. If an integer value is then assigned to $var, it becomes an integer.

An example of PHP’s automatic type conversion is the addition operator ‘+’. If either operand is a float, then both operands are evaluated as floats, and the result will be a float. Otherwise, the operands will be interpreted as integers, and the result will also be an integer. Note that this does not change the types of the operands themselves; the only change is in how the operands are evaluated and what the type of the expression itself is.

$data = “0”;  // $data is string (ASCII 48)

$data += 2;   // $data is now an integer (2)
$data = $data + 1.3;  // $data is now a float (3.3)
$data = 5 + “10 Little Piggies”; // $data is integer (15)
$data = 5 + “10 Small Pigs”;     // $data is integer (15)

If the last two examples above seem odd, see String conversion to numbers.

To force a variable to be evaluated as a certain type, see the section on Type casting. To change the type of a variable, use  settype() function.

To test any of the examples in this section, use the var_dump() function.

Note:
The behaviour of an automatic conversion to array is currently undefined.
Also, because PHP supports indexing into strings via offsets using the same syntax as array indexing, the following example holds true for all PHP versions:

$a    = ‘car’; // $a is a string
$a[0] = ‘b’;   // $a is still a string
echo $a;       // bar

Type Casting 

Type casting in PHP works much as it does in C: the name of the desired type is written in parentheses before the variable which is to be cast.

$data = 10;   // $data is an integer
$data2 = (boolean) $data ;   // $data2 is a boolean

The casts allowed are:

(int), (integer) – cast to integer
(bool), (boolean) – cast to boolean
(float), (double), (real) – cast to float
(string) – cast to string
(array) – cast to array
(object) – cast to object
(unset) – cast to NULL (PHP 5)

 

 

 

What is the difference between array_merge and array_combine ?

array_merge merges the elements of one or more than one array such that the value of one array appended at the end of first array If the arrays have same strings key then the later value overrides the previous value for that key

array_merge
<?php

$array1 = array(“course1″ => “java”,”course2″ => “sql”);
$array2 = array((“course1″ => “php”,”course3″ => “html”);
$result = array_merge($array1, $array2);
print_r($result);

?>

OUTPUT :
Array
(
[course1] => php
[course2] => sql
[course3] => html
)

Array_combine creates a new array by using the key of one array as keys and using the value of other array as values

array_combine
<?php

$array1 = array(“course1″,”course2″);
$array2 = array((“php”,”html”);
$new_array = array_combine($array1, $array2);
print_r($new_array);

?>

OUTPUT :
Array
(
[course1] => php
[course2] => html
)