We help IT Professionals succeed at work.

unexpected T_DOUBLE_ARROW

ellandrd
ellandrd asked
on

$query = array('counties' => 1,'page' => $selected_page_num,'min_price' => $min_value,'max_price' => $max_value,'sort_by' => 'price');

$property_types = array('house','apartment','duplex','bungalow');
                  
array_push($query,'property_type' => $property_types);   <-------------ERROR LINE

I've tried searching on Google for a solution but I don't understand the suggested fixes.
Comment
Watch Question

Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

Commented:
http://php.net/manual/en/function.array-push.php

array_push($query,'property_type',  $property_types);

Open in new window

Billing Engineer
Most Valuable Expert 2014
Top Expert 2009
Commented:
well, actually...
I think you want this:

$query['property_type'] = $property_types;

Open in new window

Author

Commented:
OK but I don't understand, or should I say you've confused me a little with the array_push() capability now?

I knew I can do:

array_push($array,array('value' => $value));

and

array_push($array,$value);

Which both push values into the Array $array but I didn't know I can push values into the Array $array using:

array_push($array,'value',$value);

Cool!

Thank you!