Posts

php notes

Special data type in php  Null is a special data type which can have only one value: NULL. A variable of data type NULL is a variable that has no value assigned to it. Ex:- <?php $x = "Hello world!"; $x = null; var_dump($x); ?> Output:- NULL Abstract class in php:- 1. PHP 5 introduces abstract classes and methods. Classes defined as abstract may not be instantiated, and any class that contains at least one abstract method must also be abstract. Methods defined as abstract simply declare the method's signature - they cannot define the implementation. 2. When inheriting from an abstract class, all methods marked abstract in the parent's class declaration must be defined by the child; additionally, these methods must be defined with the same (or a less restricted) visibility. 3. For example, if the abstract method is defined as protected, the function implementation must be defined as either protected or public, but not private. Furthermore the ...

To solve multiplication of numbers in few seconds

Example 1 Calculate 98 * 93 Solution Select a closest base ( a power of 10). In this case we can select 100 as a base. Write these numbers with the difference from the base. That is 98-100 = -2 and 93-100 is -7. So write it as 98   :   -2 93   :   -7 Left side of the answer will be the diagonal sum including their signs. That is 98-7=91. So 91 will be the left side of the product. (You can take the other diagonal sum also, that is 93-2=91. Always these diagonal sums will be same). To find the right hand side, just multiply the differences including their signs. That is -2 * -7 = 14 So we got that left side of the product is 91 and right side is 14. So answer is 9114 Example 2 Calculate 96 * 112 Solution Use the same method. Let's select 100 as the base (Closed to both of the numbers).Write these numbers with the difference from the base. That is 96-100 = -4 and 112-100 is 12. So write it as 96    :   -4 112  :   12 Take the...