I just needed a little help from those PHP experts here. I have a little knowledge of PHP. I am getting a PHP Fatal error: Unsupported operand types
of this code:
$ticket_item_types += array(
val_paperworkticket => 19,
val_disposal => 9,
comment => 22,
loadtime => 20,
bbls => 23,
disposalticketno => 46,
load_reviewed => 31
);
if keys are variables, then, you have to use $
before variable name, so it must be:
$ticket_item_types += array(
$val_paperworkticket => 19,
$val_disposal => 9,
$comment => 22,
$loadtime => 20,
$bbls => 23,
$disposalticketno => 46,
$load_reviewed => 31
);
if they are strings you have to quote them:
$ticket_item_types += array(
'val_paperworkticket' => 19,
'val_disposal' => 9,
'comment' => 22,
'loadtime' => 20,
'bbls' => 23,
'disposalticketno' => 46,
'load_reviewed' => 31
);
Also, take into account that +
operator with arrays must not be understood as sum operator but Union
operator
The + operator returns the right-hand array appended to the left-hand array; for keys that exist in both arrays, the elements from the left-hand array will be used, and the matching elements from the right-hand array will be ignored.
Your problem comes from your operation +=.
if $ticket_item_types is an array you should use array_push.
Otherwise,
$ticket_item_types = array( val_paperworkticket=>19, val_disposal=>9, comment=>22, loadtime=>20, bbls=>23, disposalticketno=>46, load_reviewed=>31 );
should remove the problem.