Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php function getBoxData ($parameters, $i, $allWeight, $weight, $cost){ return [[ "number"=> $i, "comment"=>'order', "weight"=>$allWeight, "length"=>$parameters['box']['a'], "width"=>$parameters['box']['b'], "height"=>$parameters['box']['c'], "items"=>[[ "ware_key"=>'001', "payment"=>["value"=>0], "name"=>'tovar', "cost"=>$cost, "weight"=> $weight, "amount"=>1 ]], ]]; } function getMassiveBox (){ $parameters['box'] = array( 'a'=>40, 'b'=>40, 'c'=>40 ); $parameters['nbb']=2; $i=1; $allWeight=6000; $weightBox=1000; $costbox=100; $weightBBox=2000; $costbbox=200; $boxData = getBoxData ($parameters,$i,$allWeight,$weightBox,$costbox); if ($parameters['nbb']!=0) { for ($i=2; $i<=$parameters['nbb']+2; $i++){ $bboxData = getBoxData ($parameters,$i,$allWeight,$weightBBox,$costbbox); array_push($boxData, $bboxData); } } var_dump ('$boxData',json_encode($boxData, JSON_PRETTY_PRINT)); } getMassiveBox();
Copy Clear