All posts by Pramod T P


It  checks if the given key or index exists in the array


 $array = array('PHP' => 1, 'JSP' => 4);
 if (array_key_exists('PHP', $array)) echo "The 'PHP' element is in the array";


The ‘PHP’ element is in the array



JSON or JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects. Despite its relationship to JavaScript, it is language-independent, with parsers available for many languages.

A format to represent any PHP type, except a resource, that can be used later in JavaScript

The JSON format was originally specified by Douglas Crockford, and is described in RFC 4627. The official Internet media type for JSON is application/json. The JSON filename extension is .json.

The JSON format is often used for serializing and transmitting structured data over a network connection. It is used primarily to transmit data between a server and web application, serving as an alternative to XML.


Magento is an e-commerce platform created on open source technology, which provides online merchants with an exceptional flexibility and control over the content, look and functionality of their e-commerce store.

Magento is an open-source content management system for e-commerce web sites. The software was originally developed by Varien Inc., a US private company headquartered in Culver City, California, with assistance from volunteers.

Varien published the first general-availability release of the software on March 31, 2008, under the name Bento. Roy Rubin, former CEO of Varien, later sold a substantial share of the company to eBay, which is now the sole owner.

According to research conducted by aheadWorks in October 2014, Magento’s market share among the 30 most popular e-commerce platforms is about 30%.

Magento employs the MySQL relational database management system, the PHP programming language, and elements of the Zend Framework. It applies the conventions of object-oriented programming and model-view-controller architecture. Magento also uses the entity–attribute–value model to store data.



Namespaces is a method with which we can group variable,function or objects so that we can have more than one variable or function or object with same name .

Namespaces were introduced into PHP from version 5.3 onwards


• Helps to prevent accidentally re-defining functions, classes, constants, …
• Avoids having to use long, highly descriptive class names
• Constants, classes, traits, interfaces and functions are affeced by the use of namespaces
• Create sub-namespaces to sub-divide a library

Declaring Namespaces

• Must declare the use of namespaces with the keyword “namespace” at the beginning of the code file (right after <?PHP)
• Use one namespace per code file (best practice)
• Unless a namespace is defined, constants, classes, functions, traits and interfaces are defined with the global namespace
• Within a namespace qualifying with a “\” references the global namespace
• Once code elements within a single namespace are defined, they can be used in other php files


 namespace php;
 class php
 public function phpcodez()
 echo 'Function1 <br />';
 namespace codez;
 class codez
 public function phpcodez()
 echo 'Function2 <br />';

$phpcodez = new phpphp();

$phpcodez = new codezcodez();



A function is a group of statements that will do certain tasks.

Why Function

When we develop a module in a project , we may need to implement certain tasks(block of statements ) more than once . Writing same block of codes more than once is not at all a good practice . Instead we can give a name to that block and can use them whenever necessary . When we define a block with a name , it is known as function .

• Blocks of code that execute in isolation (and local scope) that perform an action
• Function names are case-insensitive; defined in global scope
• Can be referenced before being defined unless function conditional
• Types: built-in (php supplied); user-defined; externally provided

General Format

function funation_name(){
echo “Error”; // can be on or more lines of statements

function – a keyword
funation_name – Any desired name(Should be meaningful)

Once the function is desfined , You can can invoke it by calling its name

<?php funation_name(); ?> // It will print the text “ Error”

A function can have arguments . When a fuction is define using arguments in it , we should pass the values when calling the it .

Example :
function function_sum($a,$b){
echo $a+$b;

<?php function_sum(7,8); ?> // It will display 15 as the result .

Note : We should not use any Builtin function name as the function name


Safe mode

Safe mode is a diagnostic mode of a computer operating system (OS). It can also refer to a mode of operation by application software. Safe mode is intended to fix most, if not all problems within an operating system. It is also widely used for removing Rogue security software.

The PHP safe mode is an attempt to solve the shared-server security problem. It is architecturally incorrect to try to solve this problem at the PHP level, but since the alternatives at the web server and OS levels aren’t very realistic, many people, especially ISP’s, use safe mode for now.

  • Limit the execution of shell commands
  • Limit access to system environment variables
  • Limit the paths from which PHP can include files using include or require


The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP.


  • Supports 12 different databases
  • Object Mapping
  • Supports prepared statements
  • Supports multiple statements
  • Object oriented interface
  • Named parameters
  • PDO has built-in support for Large Objects (LOBs).
  • When something goes wrong, PDO can throw an instance of its own exception class.
  • PDO does not emulate missing database features.
  • Placeholders within PDO prepared statements need not be named.


PHP is a server side scripting language used in web development to cerate dynamic web pages and can be embedded into HTML codes .The web server with php processor module interprets the code and geneate the web pages as per the given code .

PHP is a loosely typed language. It means you do not have to tell PHP which data type the variable is.PHP automatically converts the variable to the correct data type, depending on its value.

PHP stands for PHP Hypertext Preprocessor (A recursive acronym) .Earlier it was known as personnel home pages .

PHP is an open source software and its free to download and use .

It supports many databases like MySql,Oracle etc…



The Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents.[1] Aspects of the DOM (such as its “Elements”) may be addressed and manipulated within the syntax of the programming language in use. The public interface of a DOM is specified in its application programming interface (API).

Following are the valid DOM save methods

A. save()
B. saveXML()
C. saveHTML()
D. saveHTMLFile()


Persistent Cookie

Also called a permanent cookie, or a stored cookie, a cookie that is stored on a user s hard drive until it expires (persistent cookies are set with expiration dates) or until the user deletes the cookie.

Persistent cookies help websites remember your information and settings when you visit them in the future. This result in faster and more convenient access since, for example, you don’t have to login again.

Besides authentication, other website features made possible by persistent cookies include: language selection, theme selection, menu preferences, internal site bookmarks or favorites, among many others. On your first visit, the website is presented in default mode. During your visit, you select your preferences and these preferences are remembered, through the use of the persistent cookie, the next time you visit the site.