parse error


Posted on 16th Feb 2014 07:03 pm by admin

Parse error: syntax error, unexpected '[', expecting ')' in /Users/admin/Sites/phptest/array.php on line 5

Code: <?php

function shippingPrice($zone,$weight){
$ground = array(2 => array (
array(['lower'] => 0,['higher'] => 70,['av'] => 0.147,['base'] => 4.85);
array(['lower'] => 70,['higher'] => 100,['av'] => 0.710,['base'] => 14.82);
array(['lower'] => 100,['higher'] => 150,['av'] => 0.544,['base'] => 38.20);
)
)

foreach ($ground[$zone] as $row) {
if($row['lower'] <= $weight and $row['higher'] => $weight){

$price = (($weight - $row['base'])*$row['av']+$row['base'])
break;
}
echo shippingPrice(2,62)
?>

No comments posted yet

Your Answer:

Login to answer
298 Like 14 Dislike
Previous forums Next forums
Other forums

How do I know when getBounds Method is ready to be called.
I have an application that changes out stylesheets client side. Once I change stylesheet the browse

How do i use vars in an array
Hiya peeps!

How do I use a var in an array. You will see $id but it isnt working.


Hotlinking Picasa as the image folder of a website
Hi there PHP freaks, I would like to create a private album in Picasa to use it as the image folder

Undefined offset when using a flat file with pipe symbols
Hi, I've got a flat file/text file which I'm currently using as a member database for my site (not a

problem with refreshing
in my site, i have an index page, it has a main div. this main div's content is changing according t

array_combine() trouble w/csv file
I have a problem with a piece of code I wrote to import some records from a csv file into mysql. I h

MFC GUI Programming
I am working on a project right now that requires me to create a MFC Windows GUI. Basically it need

send() and recv() parameters confusion
On server Side:
int recv (Socket,Buffer, Length, Flags)
On Client Side:
int send (Soc

Can you help please? Php file
I have to write this php file to allow users to register their nicknames on nickserv

For an I

Strip Slashes Help
I've got a script that i've downloaded of the net to edit multiple fields from my sql database, and

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash