## Initial Preparation

First of all do a project in PHP that utilises the database. I am talking about pure PHP and not a framework. Remember to turn make sure you set the following configuration settings.

```
display_errors = 1;
error_reporting(E_ALL);
```

You can always view the php documentation which is always of great help.

## Get ready for some specialised questions

### The off-the-wall questions

**What do you think of garden gnomes?**Your answer should include some form of analysis and deduction.**Why are man-hole covers a circle?**The answer is because it is not possible for the cover to fall into the hole that way.

### PHP Specific Questions

#### Increment and Decrement Operators

Example | Name | Effect |
---|---|---|

++$a | Pre-increment | Increments by one, then returns $a.$a |

$a++ | Post-increment | Returns , then increments $a by one.$a |

–$a | Pre-decrement | Decrements by one, then returns $a.$a |

$a– | Post-decrement | Returns , then decrements $a by one.$a |

Question 1: **++$a * $a++ + $a = ? (Where $a = 5)**

Answer 1: **6 * 5 + 5 = 35**

#### Bitwise Operators

Example | Name | Result |
---|---|---|

`$a & $b` |
And | Bits that are set in both and $a are set.$b |

`$a | $b` |
Or (inclusive or) | Bits that are set in either or $a are set.$b |

`$a ^ $b` |
Xor (exclusive or) | Bits that are set in or $a but not both are set.$b |

`~ $a` |
Not | Bits that are set in are not set, and vice versa.$a |

`$a << $b` |
Shift left | Shift the bits of $a steps to the left (each step means “multiply by two”)$b |

`$a >> $b` |
Shift right | Shift the bits of $a steps to the right (each step means “divide by two”)$b |

Question 2: **echo 5 & 7;**

Answer 2:

```
5 = 0101
7 = 0111
Now AND the bits
Answer = 0101 (5)
```

Question 3: **echo 12 ^ 9;**

Answer 3:

```
12 = 1100
9 = 1001
Now XOR the bits
Answer = 0101 (5)
```

Question 4:**$x = 5; echo $x >> 2;**

Answer 4:

```
5 = 0101
Shift bits 2 steps to the right
Answer = 0001 (1)
```

#### Learn some functions of the PHP library

array_shift – Shifts an element off the beginning of an array

array_combine – Creates an associative array by using 1 for keys and 1 for values

final keyword – Prevents overriding and extension of the class

interfaces – Interfaces specify which methods a class must implement, but does not specify the code for the methods.

#### Learn some permutations, combinations and factorial

I’m not good at these and if anyone has a tutorial or content to add please free to comment.

Here are some resources that may help, if you find out how to do these please comment below.

Example Permutation and Combination Question

If ABCDEFGH are sitting at a table, where the configuration of the seats is 1 at each head of the table, and 3 on either side. If A can’t sit next to B and F can’t sit G, how many different configurations are there?

How many different numberplates can be made, if the numberplate must contain only digits and no signle digit can be repeated if there are 5 spaces for digits on the numberplate?

Please leave comments if you have anything else to add.