Tag Archives: PHP

Date functions

Magento

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.

register_long_arrays

Its a flag and if its value is set to one we must use the longer version of the variable

Array Name Longer version of the name
$_POST $HTTP_POST_VARS
$_FILES $HTTP_POST_FILES
$_GET $HTTP_GET_VARS
$_COOKIE $HTTP_COOKIE_VARS
$_ENV $HTTP_ENV_VARS
$_SERVER $HTTP_SERVER_VARS
$_SESSION $HTTP_SESSION_VARS

Its not at all a convenient option , so its always better to have the value set to off

Unicode

Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world’s writing systems. Developed in conjunction with the Universal Character Set standard and published in book form as The Unicode Standard, the latest version of Unicode consists of a repertoire of more than 109,000 characters covering 93 scripts, a set of code charts for visual reference, an encoding methodology and set of standard character encodings, an enumeration of character properties such as upper and lower case, a set of reference data computer files, and a number of related items, such as character properties, rules for normalization, decomposition, collation, rendering, and bidirectional display order

Unicode can be implemented by different character encodings. The most commonly used encodings are UTF-8, the now-obsolete UCS-2, and UTF-16. UTF-8 uses one byte for any ASCII characters, which have the same code values in both UTF-8 and ASCII encoding, and up to four bytes for other characters. UCS-2 uses two bytes for each character but cannot encode every character in the current Unicode standard. UTF-16 extends UCS-2, using four bytes to handle each of the additional characters.

Namespaces

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

Use

• 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

Example

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

$phpcodez = new phpphp();
 $phpcodez->phpcodez();

$phpcodez = new codezcodez();
 $phpcodez->phpcodez();

?>