$temp = $hobjs; foreach ($ser_arr as $key => $ser) { $ser_arr_sub = explode('-', $ser); if (in_array($ser, array_keys($sep))) { $det_pax_prices .= 'Room ' . ($key + 1) . ' -> ' . $ser_arr_sub[0] . ' Adult(s), ' . $ser_arr_sub[1] . ' children(s) : ' . $sep[$ser] * array_sum($ser_arr_sub) . '</span><br>'; $res_sel_price += $sep[$ser] * array_sum($ser_arr_sub); } else { $det_pax_prices .= 'Room ' . ($key + 1) . ' -> ' . $ser_arr_sub[0] . ' Adult(s), ' . $ser_arr_sub[1] . ' children(s) : ' . $temp[0]['@attributes']['sellpricepp'] * array_sum($ser_arr_sub) . '</span><br>'; $res_sel_price += $temp[0]['@attributes']['sellpricepp'] * array_sum($ser_arr_sub); $sep[$ser] = $temp[0]['@attributes']['sellpricepp']; unset($temp[0]); $temp = array_values($temp); } } } else { $n = distribute($seg[0]['num_adults'], $seg[0]['num_rooms']); foreach ($n as $key => $val) { $det_pax_prices .= 'Room ' . $key . ' -> ' . $val . ' Adult(s), 0 Children(s) : ' . $hobjs[0]['@attributes']['sellpricepp'] * $val . '</span><br>'; $res_sel_price += $hobjs[0]['@attributes']['sellpricepp'] * $val; } } } else { if ($seg[0]['num_rooms'] == 1) { $det_pax_prices .= 'Room 1 -> ' . $seg[0]['num_adults'] . ' Adult(s), ' . $seg[0]['num_children'] . ' Children(s) : ' . $hobjs[0]['@attributes']['sellpricepp'] * ($seg[0]['num_children'] + $seg[0]['num_adults']) . '</span><br>'; $res_sel_price += $hobjs[0]['@attributes']['sellpricepp'] * ($seg[0]['num_children'] + $seg[0]['num_adults']); } } ?> <div class="bg_grey"> <div> <div class="left">Hotel <?php
function check($expr, $given) { $eq['left'] = postfix($expr[0]); $eq['right'] = postfix($expr[1]); $eq = distribute($eq); $eq = firststep($eq); $eq['left'] = analyze($eq['left'], 'left'); $eq['right'] = analyze($eq['right'], 'right'); $eq['left'] = array_pop($eq['left']); $eq['right'] = array_pop($eq['right']); if ($eq['left'] == "x") { $resultExpr = $eq['right'] / 1; } else { $resultExpr = $eq['right'] / $eq['left']; } $eq['left'] = postfix($given[0]); $eq['right'] = postfix($given[1]); $eq = distribute($eq); $eq = firststep($eq); $eq['left'] = analyze($eq['left'], 'left'); $eq['right'] = analyze($eq['right'], 'right'); $eq['left'] = array_pop($eq['left']); $eq['right'] = array_pop($eq['right']); if ($eq['left'] == "x") { $resultGiven = $eq['right'] / 1; } else { $resultGiven = $eq['right'] / $eq['left']; } if ($resultGiven == $resultExpr) { return true; } return false; }
switch ($first_digits[$id]) { case 1: distribute("1.txt", $number); break; case 2: distribute("2.txt", $number); break; case 3: distribute("3.txt", $number); break; case 4: distribute("4.txt", $number); break; case 5: distribute("5.txt", $number); break; case 6: distribute("6.txt", $number); break; case 7: distribute("7.txt", $number); break; case 8: distribute("8.txt", $number); break; case 9: distribute("9.txt", $number); break; } } print_r($first_digits);
function email_body_hotel($postdata, $rows = array()) { $hobjs = json_decode($rows[0]['pack_info'], true); $tot_sel = 0; $ppr = ''; $pprp = ''; $sep = array(); if ($rows[0]['num_rooms'] > 1) { if ($rows[0]['num_children']) { $ser_arr = explode(',', $rows[0]['pax']); $temp = $hobjs; foreach ($ser_arr as $key => $ser) { $ser_arr_sub = explode('-', $ser); if (in_array($ser, array_keys($sep))) { $tot_sel += $sep[$ser] * array_sum($ser_arr_sub); $ppr .= 'Room-' . ($key + 1) . ' => ' . $ser_arr_sub[0] . 'Adult(s), ' . $ser_arr_sub[1] . ' Child(ren)<br>'; $pprp .= 'Room-' . ($key + 1) . ' => £' . $sep[$ser] . ' per person x ' . array_sum($ser_arr_sub) . '<br>'; } else { $tot_sel += $temp[0]['@attributes']['sellpricepp'] * array_sum($ser_arr_sub); $ppr .= 'Room-' . ($key + 1) . ' => ' . $ser_arr_sub[0] . 'Adult(s), ' . $ser_arr_sub[1] . ' Child(ren)<br>'; $pprp .= 'Room-' . ($key + 1) . ' => £' . $temp[0]['@attributes']['sellpricepp'] . ' per person x ' . array_sum($ser_arr_sub) . '<br>'; $sep[$ser] = $temp[0]['@attributes']['sellpricepp']; unset($temp[0]); $temp = array_values($temp); } } } else { $n = distribute($rows[0]['num_adults'], $rows[0]['num_rooms']); foreach ($n as $key => $val) { $tot_sel += $hobjs[0]['@attributes']['sellpricepp'] * $val; } } } else { if ($rows[0]['num_rooms'] == 1) { $ppr = $rows[0]['num_adults'] . 'Adult(s), ' . $rows[0]['num_children'] . ' Child(ren)<br>'; $pprp = '£' . $hobjs[0]['@attributes']['sellpricepp'] . ' per person x ' . ($rows[0]['num_adults'] + $rows[0]['num_children']) . '<br>'; $tot_sel += $hobjs[0]['@attributes']['sellpricepp'] * ($rows[0]['num_children'] + $rows[0]['num_adults']); } } $body = ''; $body .= '<b>Dear ' . $postdata['adult_title_1'] . ' ' . ucfirst($postdata['adult_fname_1']) . '</b> <br>Please find details of your recent search on <a href="' . base_url() . '">bookitnow.com</a><br> <br><b>YOUR PARTY:</b><br>' . $ppr . '<b><br>HOTEL:</b><br>' . urldecode($hobjs[0]['@attributes']['hotelname']) . ' in ' . urldecode($hobjs[0]['@attributes']['resort']) . '<br>' . (int) $hobjs[0]['@attributes']['starrating'] . ' Star, ' . boardbasis($hobjs[0]['@attributes']['boardbasis']) . '<br> Selected Room(s): <br>' . $pprp . 'Total Room(s): £' . $tot_sel . '<br><br><b> ATOL Admin Charge </b><br> This is an ATOL charged : 2.50 x ' . ($rows[0]['num_adults'] + $rows[0]['num_children']) . '<br> Total ATOL : £' . ($rows[0]['num_adults'] + $rows[0]['num_children']) * 2.5 . '<br><br><b> HOLIDAY TOTAL:</b> <br>£' . ($tot_sel + ($rows[0]['num_adults'] + $rows[0]['num_children']) * 2.5) . '<br><br>Want to know more? Need help or advice? Call us on 0208 548 2658 <br><br> Do not just travel, well travel! <img src="https://ci6.googleusercontent.com/proxy/FDg_fZ9IpYz-JP1QS-2FSmydrrO9Eq070M1SxzevBI5jFRZPzdiKBU9g-M2micrw8ctujkHcpQtlob_l-GoSptZElxAIVcira05itPuM5bkmq14h7x5bppNyr_LICjbpd27g4QscIQ4TvQ=s0-d-e1-ft#http://mandrillapp.com/track/open.php?u=30475359&id=4c7542725e3540b49402a5bf768304d9" height="1" width="1" class="CToWUd"><div class="yj6qo"></div><div class="adL"> </div>'; return $body; }
function team($c, $s) { $arrangement = array(-1, -1, -1, -1, -1); for ($i = 0; $i < 5; $i++) { $arrangement[$i] = pLane(probability($c[$i], array_slice($s, $i * 2, 2))); } if (array_count_values($arrangement)[0] > 1) { $arrangement = topFix($arrangement, $s); } if (array_count_values($arrangement)[-1] > 1) { # figure this mess out later } else { if (array_count_values($arrangement)[-1] == 1) { $arrangement = distribute($arrangement); } } $multiple = verify($arrangement); if ($multiple !== true) { # we have an unresolveable conflict return array(-1, -1, -1, -1, -1); } return $arrangement; }