Jump to content

parse error


jarv

Recommended Posts

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

 

<?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)
?>

Link to comment
https://forums.phpfreaks.com/topic/182626-parse-error/
Share on other sites

thanks, now I get:

Parse error: syntax error, unexpected T_FOREACH in /Users/admin/Sites/phptest/array.php on line 11

 


<?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)
?>

 

Link to comment
https://forums.phpfreaks.com/topic/182626-parse-error/#findComment-963912
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.