Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Tuesday, July 9, 2013

why we use php?

Why we use php?

1. Open Source
2. Easy
3. Web Scripting
4. Easily Integrated with html and javascript
5. Lot of frameworks
6. Lot of CMS (Content Management Systems)
7. More Jobs

Tuesday, June 25, 2013

PHP TYPE HINTING

PHP TYPEHINTING

Functions are now able to force parameters to be objects.
<?php
// An example class
class MyClass {
    public $var = 'Hello World';
}

/**
 * A test function
 *
 * First parameter must be an object of type MyClass
 */
function myFunction(MyClass $foo) {
    echo $foo->var;
}

// Works
$myclass = new MyClass;
myFunction($myclass);
?>

PHP TYPECASTING

TYPECASTING

Change variable type.
<?php
    echo (float) ( (0.1+0.7)); // echoes 0!
    echo (int) ( (0.1+0.7)); // echoes 0.8!
    echo (double) ( (0.1+0.7)); // echoes 0.8!
?>