• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Php5
 

Php5

on

  • 156 views

Basic class definitions begin with the keyword class, followed by a class name, followed by a pair of curly braces which enclose the definitions of the properties and methods belonging to the ...

Basic class definitions begin with the keyword class, followed by a class name, followed by a pair of curly braces which enclose the definitions of the properties and methods belonging to the class.

The class name can be any valid label which is not a PHP reserved word. A valid class name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*.
http://vibranttechnologies.co.in/

Statistics

Views

Total Views
156
Views on SlideShare
156
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Php5 Php5 Presentation Transcript

    • New Object-Oriented Features☞ public/private/protected accessmodifiers for methods and properties.Allows the use of common OO accessmodifiers to control access tomethods and properties:class MyClass {private $id = 18;public function getId() {return $this->id;}}
    • ☞ Unified constructor name__construct().Instead of the constructor being thename of the class, it is now declaredas __construct(), which makes iteasier to shift classes inside classhierarchies:class MyClass {function __construct() {print "Inside constructor";}}
    • ☞ Object destructor support bydefining a __destructor() method.Allows defining a destructor functionthat runs when an objectis destroyed:class MyClass {function __destruct() {print ”Destroying object”;}}
    • ☞ Interfaces.Gives the ability for a class to fulfill morethan one is-a relationships. A class caninherit only from one class, but mayimplement as many interfaces as it wants:interface Display {function display();}class Circle implements Display {function display() {print "Displaying circlen";}}
    • ☞ instanceof operator.Language-level support for is-arelationship checking. The PHP 4is_a() functionis now deprecated:if ($obj instanceof Circle) {print $obj is a Circle;}
    • ☞ Final methods.The final keyword allows you to markmethods so that an inheriting classcannot overloadthem:class MyClass {final function getBaseClassName() {return __CLASS__;}}
    • ☞ Final classes.After declaring a class as final, itcannot be inherited. The followingexamplewould error out.final class FinalClass {}class BogusClass extends FinalClass {}
    • ☞ Static methods.You can now define methods as static byallowing them to be called fromnon-object context. Static methods do notdefine the $this variablebecause they are not bound to any specificobject:class MyClass {static function helloWorld() {print "Hello, world";}}MyClass::helloWorld();
    • • ☞ Abstract classes.• A class may be declared abstract to prevent itfrom being instantiated.• However, you may inherit from an abstract class:• abstract class MyBaseClass {• function display() {• print "Default display routine being called";• }• }