PHP Variables Not Displaying in Browser -


i have following function:

function getallproducts($productcount) { $productsparsed = 0; $limit = 250; $pages = ceil($productcount / $limit); $pagenumber = 1; $filters = ""; $requestparams = array("page" => $pagenumber, "limit" => $limit, "include" => $filters);  echo $productcount . " products parse... \n"; echo "=======================================\n";  if ($productcount <= $limit) {     $products = bigcommerce::getproducts($requestparams);     $products = (array) $products;      foreach ($products $product) {         $productsparsed++;         echo $product -> name . "   " . $product -> price . "\n";     } } else { // more $limit products in catalog.     while ($productsparsed <= $productcount) {         if ($productsparsed === 0 || $productsparsed % $limit > 0) {             // 0 or not on multiple of $limit             $products = bigcommerce::getproducts($requestparams);             $productsobject = new arrayobject($products);             $productsarray = $productsobject->getarraycopy();              foreach ($productsarray $product) {                 $productsparsed++;                 echo $product -> name . "   " . $product -> price . "\n";             }         } else {             // multiple of $limit             $pagenumber++;             $requestparams = array("page" => $pagenumber, "limit" => $limit, "include" => $filters);             $products = bigcommerce::getproducts($requestparams);             $productsobject = new arrayobject($products);             $productsarray = $productsobject->getarraycopy();              foreach ($productsarray $product) {                 $productsparsed++;                 echo $product -> name . "   " . $product -> price . "\n";             }         }     } } if ($productsparsed == $productcount) {     echo "=======================================\n products accounted for.\n"; } else {     $missingproducts = $productcount - $productsparsed;     echo "=======================================\n" . $missingproducts . " products unaccounted for.\n"; } } 

when run script @ command line performs expected, correct product count, output $product variable, in browser none of variables echo back, end with:

<!doctype html> <html lang="en"> <head>     <meta charset="utf-8">     <title>document</title> </head> <body>   products parse...  ======================================= =======================================  products accounted for.  </body> </html> 

what cause echo differently between terminal , browser?


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -