Sunday, June 11, 2017

Interview Questions and Answers - Object Orient Programming in PHP (OOP) - Intermediate

Question. No. 1:
What are magic methods ?

  • __construct : called while initializing an object with a "new" keyword
  • __destruct : when object is going out of scope.
  • __call : When method doesn't exists or access restricted in Object scope
  • __callStatic : When method doesn't exists or access restricted in Static Scope
  • __get : when trying to read a variable which doesn't exist or access restricted
  • __set: when trying to set a variable which doesn't exist or access restricted
  • __isset : when trying to check isset a variable which doesn't exist or access restricted
  • __unset : when trying to unset a variable which doesn't exist or access restricted
  • __sleep :  when serialize an object in order to store in database 
class myClass

       var $var1 = 3; 

private $var2 = 2;
    public function __sleep()
        return array('var1', 'var2');
$myObj= new myClass;

  • __wakeup : when un-serialize an object get serialize object then un-serialize it 
class myClass

       var $var1 = 3; 

private $var2 = 2;
    public function __wakeup ()
        return array('var1', 'var2');
$myObj= new myClass;

$se = serialize($myObj);

  • __toString: when a class object was printed as string this method will be called
class myClass
    public function __toString()
        return 'class name';

$myObj = new myClass;
echo $myObj;
  • __invoke : when declared ,it will be used as a callable function with instantiated object name. it takes same number of arguments passed.
class myClass
    public function __invoke($x,$y)
        echo $x.$y;
$myObj = new myClass;
$myObj (4,5);

  • __set_state : when var_export() function called on the object
  • __clone : when called clone on an object. when we try to tract the serials of cloned.
  • __autoload : its not a method but Function, 

Wednesday, June 7, 2017

Interview Questions and Answers - Object Orient Programming in PHP (OOP) - Basics

what is class?


  • Its a blue print (Technical Design/structure) of how methods & behaviors will be written/shown. 

What is an object?


  • Its an instance of a class.

What is the Interface?

  • functionality cannot be provided
  • properties cannot be defined
  • it is to enforce child class to implement all the methods existing in interface is a MUST. 
  • it cannot be instantiated. 
  • methods can only be public inside interface.
  • child class can only implement not extend with interface
  • every method should be abstracted 
  • multiple inheritance is possible with implements keyword
  • multi-level inheritance is possible , that is an interface can extend parent interface and a class can implement child interface and it should implement all the methods from parents interfaces.

Question 4:
What is an Abstract class?


  • functionality can be provided inside it
  • properties can be defined inside it
  • Methods cannot be private, 
  • child class must implement abstract methods
  • child class can extend an abstract class with "extends" keyword instead of "implements" 
  • not every method should be abstract
  • multiple inheritance is not possible

Question 5:
What are properties?


  • information / data/state of an object
Question 6:
What is are Methods?


  • Functions or behaviors of the class
Question 7:
What is Encapsulation?


  • to enclose the properties and behaviors in curly braces so that we don't need to know the information processing inside a class while working with an API calls to this class.
Question 8:
What are Visibility/Access Modifiers?

  • Public - accessible from everywhere
  • Protected - accessible from within class as well child classes
  • private  - accessible from within class ONLY 
Question 9:
What is Static?

  • Method or property available at class level , no object needed
  • changes will affect everywhere in all the instances of the class
Question 10:
What is Constructor?

  • Its a magic method
  • used to initialize the properties of an object 
Question: 11:
What is Polymorphism:

Its a concept that an object can have different forms, means a class can have many child classes which are related to parent class but having different behaviors.


interface Speaking{
     public function speak();

cat implements speaking{
     public function speak(){
           echo 'meeaoo';

dog implements speaking{
     public function speak(){
           echo 'woooah';

person implements speaking{
     public function speak(){
           echo 'lets go';

Thursday, December 10, 2015

MEAN Stack Tutorials and courses - MongDB, ExpressJS, AngularJS, NodeJS

MEAN Stack RESTful API Tutorial (1/5) - Using MongoDB, Express, AngularJS, and NodeJS Together

Node awesome modules to be used Take all updated module from this link
MEAN Stack Intro: Build an end-to-end application - must watch again and again
RestFull API Basics REST call

Building your first MEAN application - good intro to Mongo DB
awesome blog example using mongodb node.js
Good express module for Node js application for nitification



d3 with angular.js


WATCH all this video TO LEARN NODE.JS
TJ Holowaychuck's modular web applications with node js and express 1152x720

Morris chart in angular.jss
kyle simpson about java script


Node Guides - Understanding Event Emitter



Saturday, October 31, 2015

document ready in javascript - alternative to $(document).ready

There are many Answers available for the above question on the following URL.

Friday, October 9, 2015

PNG to JPG - Covertion and Compression - PHP

Code is below:



$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["myfile"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);

move_uploaded_file($_FILES["myfile"]["tmp_name"], $target_file);

$filePath = './uploads/'.basename( $_FILES["myfile"]["name"]);
$image = imagecreatefrompng($filePath);
$bg = imagecreatetruecolor(imagesx($image), imagesy($image));
imagefill($bg, 0, 0, imagecolorallocate($bg, 255, 255, 255));
imagealphablending($bg, TRUE);
imagecopy($bg, $image, 0, 0, 0, 0, imagesx($image), imagesy($image));
$quality = 50; // 0 = worst / smaller file, 100 = better / bigger file

$image_name = str_replace('.png','',$filePath);

imagejpeg($bg, $image_name . ".jpg", $quality);




<form action="" enctype="multipart/form-data" method="post">
         <input type="file" name="myfile" value="" >
         <input type="submit" name="submit" >

Sunday, July 26, 2015

PHP MYSQL Advance Course Structure

  • Introduction to advance programming
  • basic php techniques
  • introduction to Object oriented programming
  • Object oriented programming in practice
  • Project Setup (creating directories etc, creating MYSQL database)
  • Creating database class, User class, session class etc
  • admin login and account management
  • Working with the files and directories
  • uploading files 
  • Completing User Class - CRUD
  • Ajax in practice
  • Introducing E-commerce
  • Database designing
  • Working with the Products class
  • Displaying Products on frontend with Pagination
  • Searching , Advance Search
  • Creating Cart
  • updating Cart
  • checkout process
  • Products Reviews/Rating ,commenting
  • Contact Us, Working with Emails
  • MVC Basics

Almost 35 Lectures  . 
Total Course Price $250
Single Lecture $10



Fee Structure

Html and css combine lectures = $120
javascript =  $150
jQuery     =  $100
Basic level of php mysql = $180
Advance level of PHP mySQL (Ajax included) = $250
Codeigniter = $150