Meaning of Life

I have been reading, discussing and thinking about it from past many days and months and as I understand clearly that each person has its own meaning of life and there is no general meaning of life for each person. In my opinion there is no fixed meaning of life, meaning of life changes from […]

How to Setup CakePHP Using Xampp On Windows

Step 1: Download XAMPP and CakePHP. Step 2: Install Xampp Step 3: Mod Rewrite Module Once Xampp is installed as the local server, you can then proceed to enable mod_rewrite. To do so, you will have to open the httpd.conf file that is located in C:\xampp\apache\conf and uncomment by removing # from the following line: […]

How MVC works?

CakePHP follows the MVC software design pattern. Programming using MVC separates your application into three main parts: The Model represents the application data The View renders a presentation of model data The Controller handles and routes requests made by the client CakePHP request cycle The typical CakePHP request cycle starts with a user requesting a […]

Understanding the MVC Pattern Models

CakePHP follows the MVC software design pattern. Programming using MVC separates your application into three main parts: The Model layer The Model layer represents the part of your application that implements the business logic. It is responsible for retrieving data and converting it into meaningful concepts for your application. This includes processing, validating, associating or […]

Try, catch, throw

To avoid the error from the example above, we need to create the proper code to handle an exception. Proper exception code should include: Try – A function using an exception should be in a “try” block. If the exception does not trigger, the code will continue as normal. However if the exception triggers, an […]

Understanding Exception and error

What is an Exception? With PHP 5 came a new object oriented way of dealing with errors. Exception handling is used to change the normal flow of the code execution if a specified error (exceptional) condition occurs. This condition is called an exception. This is what normally happens when an exception is triggered: The current […]

Final

In some cases you may want to prevent a class from being inherited from or a function to be overridden. This can be done with the final keyword, which simply causes PHP to throw an error if anyone tries to extend your final class or override your final function. A final class could look like […]

Interface

What is an Interface? An interface is a contract between unrelated objects to perform a common function. An interface enables you to specify that an object is capable of performing a certain function, but it does not necessarily tell you how the object does so, this means that it leaves for classes implementing an interface […]

Abstract class

What is an Abstract Class? An abstract class is a class with or without data members that provides some functionality and leaves the remaining functionality for its child class to implement. The child class must provide the functionality not provided by the abstract class or else the child class also becomes abstract. Objects of an […]

Instanceof operator

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. Lets look at an example below: class Student { … }$p1 = new Student(); $p2 = new Student();if($p1 instanceof $p2) echo “True”; else echo “False”; […]