Featured Posts

Writing Website Scrapers in PHPWriting Website Scrapers in PHP This article discusses about how to write a website scraper using PHP for web site data extraction. The concepts taught can be applied and programmed in Java, C#, etc. Basically any language that has a...

Readmore

12 common programming mistakes to avoid12 common programming mistakes to avoid Programming is an art and science and like all art and science the only way to learn is from mistakes. I have made many... and I would like to share with you the mistakes that I have made over my journey...

Readmore

7 habits of highly effective freelance programmers7 habits of highly effective freelance programmers I have developed these based on my freelancing experience. Though I have discontinued freelancing, but would like to share my practices with you. These are basic practices and have been developed over...

Readmore

  • Prev
  • Next

PHP 5 Tutorial - Handling Exceptions in PHP5

Posted on : 14-02-2008 | By : admin | In : PHP, PHP Class Examples, PHP Code Examples, PHP Tutorials, PHP5 OOPS Tutorials

2

If you're new here, you may want to subscribe to my Newsletter. Thanks for visiting!

In this tutorial we will cover the following:

  • What is an exception?
  • The use of a try…catch block
  • Anatomy of PHP5 Exception class
  • Extending the Exception class
  • A note on unhanded exceptions

PHP 5 Tutorial - Final Class and Methods

Posted on : 14-02-2008 | By : admin | In : PHP, PHP Class Examples, PHP Tutorials, PHP5 OOPS Tutorials

5

In this PHP tutorial we will understand the following:

  • Meaning of Final Class
  • Meaning of Final Method
  • When to declare a class as final
  • When to declare a method as final

PHP 5 Tutorials - Static Data Members and Methods

Posted on : 12-02-2008 | By : admin | In : PHP, PHP Class Examples, PHP Tutorials, PHP5 OOPS Tutorials

1

In this tutorial you will learn all about static data members and methods

  • Meaning of static data members
  • Meaning of static methods
  • Defining static data members in PHP5
  • Defining static methods in PHP5
  • Accessing static data members in PHP5
  • Accessing static methods in PHP5
  • Rules to keep in mind for static methods

PHP5 Tutorial - Inheritance in PHP5

Posted on : 15-11-2007 | By : admin | In : PHP, PHP Tutorials, PHP5 OOPS Tutorials

0

In the tutorial we will understand what is Inheritance in general and how to inherit classes in PHP5.

Definition of Inheritance:

Inheritance is the mechanism of deriving a new class from an existing class. It allows a sub-class / child class to share/inherit the attributes and behaviors of a base-class or parent class. These inherited attributes and behaviors are usually modified by means of extension.

PHP5 Tutorial - Defining Class Constants

Posted on : 15-11-2007 | By : admin | In : PHP, PHP Tutorials, PHP5 OOPS Tutorials

1

In PHP4 the only constants that we would declare were global constants. In PHP5 it is possible to define a class level constant. These constants are specific to the class and hence don’t clutter the global level constant space.

PHP5 Tutorial - instanceOf Operator Explained

Posted on : 15-11-2007 | By : admin | In : PHP, PHP Tutorials, PHP5 OOPS Tutorials

1

PHP5 introduces a new operator by the name of instanceOf. instanceOf is used to check if two objects passed as operands belong to the same class. This check can also happen when an object is compared with a class name.

In PHP4 a similar functionality existed with a method is_a(), which has been replaced by the instanceOf operator in PHP5.

PHP5 Tutorial - $this variable explained

Posted on : 14-11-2007 | By : admin | In : PHP, PHP Tutorials, PHP5 OOPS Tutorials

4

$this variable is a pointer to the object making the function call. $this variable is not avialable in static methods. We will learn more about static methods in the next series of tutorials.

Stack Implementation in PHP5 - Stack Class

Posted on : 14-11-2007 | By : admin | In : PHP, PHP Class Examples, PHP Tutorials

1

Refer to the code below which is a PHP5 Stack Class - an implementation of Stacks. You are free to use it in your programs.

PHP5 Tutorial - Function - Method Type Hinting in PHP5

Posted on : 14-11-2007 | By : admin | In : PHP, PHP Tutorials, PHP5 OOPS Tutorials

1

PHP5 Introduces Method Type Hinting. Type Hinting allows a function to force parameters to be objects of a particular class by specifying the name of the class in the function prototype.

Type Hinting is optional in all cases except catch block.

PHP5 Tutorial OOPS - PHP5 Class Access Specifiers - public, private and protected

Posted on : 14-11-2007 | By : admin | In : PHP, PHP Tutorials, PHP5 OOPS Tutorials

13

In the earlier tutorials we have witnessed keywords like public, private and protected. These are nothing but access specifiers. So, lets understand what access specifiers are.

Definition of Access Specifiers
Access specifiers specify the level of access that the outside world (i.e. other class objects, external functions and global level code) have on the class methods and class data members. Access specifiers can either be public, private or protected.