function countStrings($in) { $list = explode("\n", $in); $tot = 0; foreach ($list as $str) { if (!$str) { continue; } $code = countCode($str); $bytes = countBytes($str); $tot -= $code; $tot += $bytes; } echo "Tot is {$tot}\n"; }
session_start(); echo "<pre>"; print_r($_POST); //print_r($_SESSION); echo "</pre>"; //กลุ่มรับค่า //ส่งข้อมูล หน้า add product มาหน้านี้ //$productCode = $_POST['productCode']; //$code_order = $_POST['code_order']; $idshop = $_POST['idshop']; $date_order = $_POST['date_order']; $time_order = $_POST['time_order']; $detail_order = $_POST['detail_order']; //ส่งข้อมูล หน่วยสินค้า มาหน้านี้ $products = $_SESSION["product"]; $countCode = countCode($idshop); $num = $countCode["CountCode"]; $code_order = $num + 1; echo $code_order; //สิ้นสุดกลุ่มรับค่า // //กลุ่มคำสั่งทำอะไร //if (!checkcode($productCode)) { //echo checkDuplicateProduct($productName, $factoryID); if (isset($_SESSION["product"])) { //ถามว่า$_SESSION["unit"]ถูกสร้างหรือยัง $idorder = addOrder($code_order, $idshop, $date_order, $time_order, $detail_order); //idproductของระบบ echo "idorder=" . $idorder; if ($idorder > 0) { //$idUnit[1] = addUnit($idproduct, 0, $units[1]['AmountPerUnit'], $units[1]['NameUnit'], $units[1]['price'], $units[1]['type']);