XF 2.1 $a=[$b]

Robert9

Well-known member
$resource->sv_prefix_ids = [$resource->prefix_id];

I dont know how to search for that; what means => [ ]<= around [$resource->prefix_id], please?
 
[] stands for an empty array, [$resource->prefix_id] stands for an array with int value (here prefix id).
 
Depends if $resource->sv_prefix_ids is already instantiated as an array and if it has values.

$resource->sv_prefix_ids = [$resource->prefix_id]; - This will create a brand new array with exactly one value.

$resource->sv_prefix_ids[] = $resource->prefix_id; - This will append the value onto the end of the array.
 
Top Bottom