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

Please help with code for SMTP authenticated PHP email form
Hello, I'm creating a PHP email form, and for this particular server, I have to use SMTP Authenticat

New to PHP and just trying to understand a little code.
I hope I'm not annoying anyone or breaking the rules but I was wondering about this bit of code righ

DELETE rows based on content
I have a link in my rows

$bit="http://bit.ly/abcd";
$query = mysql_query("D

Combining Two Queries
I have two scripts that each work fine by themselves. One is a search script with a variable that de

onclick problem
I have <input type="text" name="message">
<a href=page2.

Simple PHP/Java Help..
Hi,
I'm trying to build a little program to do with calculating postage. Unfortunately i haven't

Help with translating C code into assembler code
Hi im doing a project that moves a robot around a maze avoiding walls and need some help with conver

help connecting a form to php and then emailing the form
Ok. So, I made a form, and I need help to where when submitted, I get an email with the submitted de

Doubles are giving me problems
Ok so, first of all i made a double = 0.05, but when running the debugger it shows up as 0.04999. I

script is pulling more then they have....
I have this script for my game where they can change there race. This will cost them 2,500 points. H

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