function mem() { $x = memory_get_peak_usage(TRUE) / 1024; $x = number_format($x, 2); printer("Mem: " . $x . " KB \n"); unset($x); }
<?php include "ext/defs.php"; $x = new X(1, 2); printer((string) $x);
<?php $l_aMonths = array('01' => 'Янв', '02' => 'Фев', '03' => 'Мар', '04' => 'Апр', '05' => 'Май', '06' => 'Июн', '07' => 'Июл', '08' => 'Авг', '09' => 'Сен', '10' => 'Окт', '11' => 'Ноя', '12' => 'Дек'); //$l_sPath = 'xmls/'; $l_sPath = '/home/eyezeek/netup/ru/trends/'; $l_sFileName = 'jobs_charts'; $l_iNumOfPoints = 20; $eyezeek = new mysqli("192.168.240.15", "eyezeek", "p!n6access", 'ru_eyezeek'); /* check connection */ if ($eyezeek->connect_errno) { printer("Connect failed: " . $eyezeek->connect_error); exit; } /* set character set */ if (!$eyezeek->set_charset("utf8")) { print "\nError loading character set utf8: " . $eyezeek->error; } //fetch 15 most popular positions $sql = 'SELECT l_position,count(*) as num FROM jobs where l_location_city="Москва" and l_salary_from>100 group by l_position order by num desc limit 15'; $result = $eyezeek->query($sql); $l_aPositions = array(); while ($row = $result->fetch_object()) { $l_aPositions[] = $row->l_position; } //copy xml to temp file, to not destroy the live copy($l_sPath . $l_sFileName . '.xml', $l_sPath . $l_sFileName . '_temp.xml'); $xml = new DOMDocument("1.0", "utf-8"); $xml->formatOutput = true; $xml->preserveWhiteSpace = false; foreach ($l_aPositions as $l_sPosition) { //fetch a median salary for this position
{ (yield 3); (yield 4); } foreach (gen() as $val) { echo $val, PHP_EOL; } //可以send一个yield function printer() { while (true) { $string = yield; echo $string; } } $printer = printer(); $printer->send("Hello World"); function nums() { for ($i = 0; $i < 5; ++$i) { //get a value from the caller $cmd = (yield $i); if ($cmd == 'stop') { return; } //exit the function } } $gen = nums(); foreach ($gen as $v) { if ($v == 3) {
function printLines(DataToExcel $dataToExcel){ $iterator = $dataToExcel->getAllLinesValues()->getIterator(); printer($iterator); }
<?php printer(send_email('*****@*****.**')); ?> <h1>Testing Transactions</h1> <?php if (!$this->session->userdata('customer_profile_id')) { ?> <form method="post"> <h2>Create A Profile</h2> <p>Email:<input type="text" name="email"/></p> <p>User id:<input type="text" name="user_id"/></p> <p><input type="submit"/></p> <input type="hidden" name="create_profile" value="1"/> </form> <hr/> <?php } ?> <?php if (!$this->session->userdata('customer_payment_profile_id')) { ?> <form method="post"> <h2>Create A Payment Profile</h2> <p>Profile Id:<input type="text" name="customer_profile_id" value="<?php echo $this->session->userdata('customer_profile_id'); ?> "/></p>
public static function blockList() { return printer(self::get_all_blocks()); }
function test31() { printer("asd ", id("foo")); }
/** * @test */ public function test_nonserializable() { $a = (object) array('test' => 123); if (PHP_VERSION_ID > 55000) { function printer() { while (true) { $string = yield; echo $string; } } $p = printer(); $a->bc = $p; } $a->pp = function ($ff) { return 5 + $ff; }; $p = new serpri($a); ob_start(); $p->process(); $ret = ob_get_clean(); if (PHP_VERSION_ID > 55000) { $this->assertContains('(G)Generator::__set_state(array(', $ret); } $this->assertContains('(C)Closure::__set_state(array(', $ret); }
/** * @author Shalltell Uduojie * @desc This is used to void transactions * @param $profile_id * @param $payment_id * @param $trans_id * */ function void($profile_id, $payment_id, $trans_id) { $content = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" . "<createCustomerProfileTransactionRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">" . $this->MerchantAuthenticationBlock() . "<transaction>" . "<profileTransVoid>" . "<customerProfileId>{$profile_id}</customerProfileId>" . "<customerPaymentProfileId>{$payment_id}</customerPaymentProfileId>" . "<transId>{$trans_id}</transId>" . "</profileTransVoid>" . "</transaction>" . "</createCustomerProfileTransactionRequest>"; $response = $this->send_xml_request($content); $parsedresponse = $this->parse_api_response($response); printer($parsedresponse); //@TODO: add response data for void return 1; }
$www_cpc = array(); if ($l_sSection == 'vehicles') { $www_cpc[0] = $cpc; $www_cpc[1] = ''; $www_cpc[2] = ''; } elseif ($l_sSection == 'realestate') { $www_cpc[0] = ''; $www_cpc[1] = $cpc; $www_cpc[2] = ''; } elseif ($l_sSection == 'jobs') { $www_cpc[0] = ''; $www_cpc[1] = ''; $www_cpc[2] = $cpc; } } $www_cpc = implode('|', $www_cpc); $sql = "UPDATE np_wwwsite set www_cpc = '" . $www_cpc . "',www_allow_promoted=1 WHERE www_id=" . $www_id; $result = $eyezeek->query($sql); printer("{$sql}. Rows affected: " . $eyezeek->affected_rows); } } $sql = "UPDATE np_wwwsite SET www_allow_promoted=0, www_cpc='' WHERE www_id NOT IN (" . implode(', ', $all_promoted) . ") AND www_allow_promoted=1"; $result = $eyezeek->query($sql); printer("{$sql}. Rows affected: " . $eyezeek->affected_rows); $eyezeek->close(); $alps->close(); } function printer($str) { print "\n" . date("d/m/y : H:i:s", time()) . " pid: " . getmypid() . " " . $str; }
} echo "</tr>"; } fclose($f); echo "\n</table></body></html>"; } // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $stmt = $conn->prepare("SELECT dlink,room FROM layout WHERE usn=?"); $stmt->bind_param("s", $usn); $stmt->execute(); /* bind result variables */ $stmt->bind_result($dlink, $room); /* fetch value */ $stmt->fetch(); if (empty($dlink) || empty($room)) { die("Sorry this usn is not present in our database"); } echo "<html><head>"; echo "<a href=" . "\"" . $dlink . "\"" . ">" . "Click to download</a><br/><br/><br/>"; $conn->close(); printer($dlink, $room); ?> </body> </html>