Is better to use $id_name ( Class A Method b() )
OR $id_name_2 ( Class A Method c())
?
<?php
Class A {
function a(){
$params = array(
'id'=> 1,
'name' => 'b',
);
$id_name = $this->b($params);
$id_name_2 = $this->c($params);
}
function b($params){
$id = $params['id'];
$name = $params['name'];
/*******
Some code performing operations with $name and $id
********/
$str = $id . $name;
return $str;
}
function c($params){
/*******
Some code performing operations with $params['name'] and $params['id']
********/
$str = $params['name'] . $params['id'];
return $str;
}
}
$params
being used at all inside of the "Code Performing Operations?" If not, both methods are nearly identical. \$\endgroup\$ – Kayla Mar 27 '14 at 2:42