<?php
/**
* Array Differencing in PHP 5.4
* Author: Nathan
* Date: 24/06/12
*/
/* PHP 5.4 method []
*Square brackets can be used in place of parentheses
*/
function getArray54()
{
return [
'key' => 'value',
'another' => 'another_value',
'number' => array(1 ,2 ,3 ,4)
];
}
//Call new method
var_dump(getArray54() ['numbers']);
/* PHP 5.3 method {}
*Older method with parentheses and array keyword
*/
function getArray53()
{
return array(
'key' => 'value',
'another' => 'another_value',
'number' => array(1 ,2 ,3 ,4)
);
}
//Call to older method
var_dump(getArray253());