Using arrays, I see quit often the following formatting :
$somearray = array( 'one'=>'one_value',
'twokey'=>'two_value',
'some_third_value'=>'some_other_value',
'987654'=>'12340987',
'confused_yet_456789'=> $some_var,
'confused_yet_rt78466'=>'two_value'
);
that is of course instead of the one liner :
$somearray = array( 'one'=>'one_value','twokey'=>'two_value','some_third_value'=>'some_other_value','987654'=>'12340987','confused_yet_456789'=> $some_var,'confused_yet_456789'=>'two_value');
However , I for myself have never encountered or seen it used in a functions $parameters
assignment, e.g :
function my_function_3($somevar='some_value_or_other',$title='some_87654_num_value',$cool_stuff='right_or_left',$dashboards='91234765',$menu='some_6374_menu'){
return $cool_stuff;
}
Expanded to :
function my_function_3( $somevar='some_value_or_other',
$title='some_87654_num_value',
$cool_stuff='right_or_left',
$dashboards='91234765',
$menu='some_6374_menu'
){
return $cool_stuff;
}
The same goes for echo
or return
.
From this :
$output .= '<img src="http://chart.apis.google.com/chart?cht=qr&chs='.$qr_size .'x'.$qr_size .'&chld=L|4&chl=' . $string . '" width="'.$qr_size.'" height="'.$qr_size.'" alt="Some alt to describe QR code" title="QR code for your phone"/>';
to this :
$output .= '<img src="http://chart.apis.google.com/chart?cht=qr&chs='.
$qr_size .'x'.
$qr_size .'&chld=L|4&chl=' .
$string . '" width="'.
$qr_size.'" height="'.
$qr_size.'" alt="Some alt to describe QR code" title="QR code for your phone"/>';
So , my question is :
Can I use this syntax or formatting also in $parameters
assignment in a function, as well as echo
/ return
?
if no - why ? can it fail on certain configs ? is it just wrong ?
..and if yes , what is the correct way to do so (break the line BEFORE or AFTER the comma / dot ) ??