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

Suggestions for Functional module
Hello experts,
I Have done B.Sc(Mathematics) and MCA & have learnt SAP/ABAP but do n

Working with popups and such in a class
I've recently started building my applications completely enclosed in classes. I like the fact that

Why is my row count 0?
Here's the MySQL query i'm running. It basically pulls data from 2 tables based on some data passed.

Socket programming
Hello all,

I have a PHP socket script. GPS trackers connect to this socket. IMEI verification

Access database inside of a validation class
Hello,

For quite some time, I have been using functions to validate form input and access the

Help If user voted, block them
On my Prayer request site, i let users Click a button to Pray for somone that has posted a pray, i g

Ten Operator Syntax
Hi Guys,

I can't figure out why i am getting a parse error with this basic ten op code:

Join Query Help
Hi all,

I am having problems with the below code, which we shall call 'my first join query'!

single page with referrer to show correct page
I have a simple website with a couple of different pages. I would like to be able to in a div tag w

Match stored value with the current value in a loop
Hello,

I have a MySQL db were I store articles in.

I have a form to fill these article

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