function do_stuff() { /* 26.9|0.0|0.0|31.4|0.00|0.00|0.00|0.00 */ $result = file_get_contents('http://ourproject.dyndns-server.com:8099/&'); echo $result; $rs = explode('|', $result); echo "\n"; $now = new DateTime(); $b = R::dispense('timedate'); $b->time = $now->format('Y-m-d H:i:s'); $b->T1 = $rs[0]; $b->T2 = $rs[1]; $b->T3 = $rs[2]; $b->T4 = $rs[3]; $b->V1 = $rs[4]; $b->V2 = $rs[5]; $b->V3 = $rs[6]; $b->V4 = $rs[7]; R::store($b); echo $b->time; echo "\n"; // MySQL datetime format sleep(10); // wait 20 seconds do_stuff(); // call this function again }
function do_stuff() { $now = new DateTime(); echo $now->format('Y-m-d H:i:s'); echo "\n"; // MySQL datetime format // echo $now->getTimestamp(); sleep(10); // wait 20 seconds do_stuff(); // call this function again }
<?php function do_stuff($url) { $handle = curl_init('http://127.0.0.1:37349/'); curl_setopt($handle, CURLOPT_VERBOSE, true); curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); curl_setopt($handle, CURLOPT_STDERR, $o = fopen($url, "w+")); curl_exec($handle); echo "About to rewind!\n"; rewind($o); echo stream_get_contents($o); return $o; } echo "temp stream (close after):\n"; fclose(do_stuff("php://temp")); echo "\nmemory stream (close after):\n"; fclose(do_stuff("php://memory")); echo "\ntemp stream (leak):\n"; leak_variable(do_stuff("php://temp"), true); echo "\nmemory stream (leak):\n"; leak_variable(do_stuff("php://memory"), true); echo "\nDone.\n";
* Test that all untranslated encapsed strings are caught. * * At the same time it is used to test that strings are properly ignored. * * @package WP_L10n_Validator\Tests * @since 0.1.0 */ $unstranslated = 'translate me!'; $untranslated = some_function('I should be translated'); echo 'l10n is fun.'; $ignored = ignored_function('ignored string'); include 'some_file.php'; require_once MY_CONSTANT . '/another_file.php'; switch ($var) { case 'bob': case 'joe': do_stuff(); break; } $url = 'http://example.com/'; $not_url = 'http is a web protocol'; $ignore = 'all_lowercase_with_underscores'; $ignore = '_underscore_in_front'; $catch_me = "Don't {$ignore} this!"; $file = 'file/to/ignore.php'; $path = '/includes'; $other_path = 'src/includes/'; $maybe = 'and/or'; // This was giving an error for the '-' in the first arg, even though the first arg // was supposed to be ignored. add_meta_box("{$this->current_points_type}-{$slug}", $ignored->get_title(), array($this, 'display_event_meta_box'), $this->id, 'events', 'default', array('points_type' => $this->current_points_type, 'slug' => $slug));
function main() { $count_items = 10; // assume this is determined on runtime do_stuff($count_items); }
break; case 'showagain': display_form($projectid_, $from_image_, $page_name_handling, $transfer_notifications, $add_deletion_reason, $merge_wordcheck_files, $repeat_project, TRUE); break; case 'check': do_stuff($projectid_, $from_image_, $page_name_handling, $transfer_notifications, $add_deletion_reason, $merge_wordcheck_files, TRUE); echo "<form method='post' action='" . attr_safe($copy_pages_url) . "'>\n"; display_hiddens($projectid_, $from_image_, $page_name_handling, $transfer_notifications, $add_deletion_reason, $merge_wordcheck_files); echo "\n<input type='hidden' name='action' value='docopy'>"; echo "\n<input type='submit' name='submit_button' value='" . attr_safe(_("Do it")) . "'>"; echo "\n</form>"; echo "<div style='height: 4em;'> </div>"; // Spacer break; case 'docopy': do_stuff($projectid_, $from_image_, $page_name_handling, $transfer_notifications, $add_deletion_reason, $merge_wordcheck_files, FALSE); echo "<hr>\n"; $url = "{$code_url}/tools/project_manager/page_detail.php?project={$projectid_['to']}&show_image_size=0"; echo sprintf(_("<p><a href='%s'>Go to destination project's detail page</a></p>\n"), $url); echo "<form method='post' action='" . attr_safe($copy_pages_url) . "'>\n"; echo "<fieldset>\n"; echo "<legend>" . _("Copy more pages...") . "</legend>"; echo "<input type='radio' name='repeat_project' id='rp-1' value='FROM'>"; echo "<label for='rp-1'>" . _("From the same project") . "</label>"; echo "<input type='radio' name='repeat_project' id='rp-2' value='TO'>"; echo "<label for='rp-2'>" . _("To the same project") . "</label>"; // Or explicitly just go back to the original blank form by default echo "<input type='radio' name='repeat_project' id='rp-3' value='NONE' CHECKED>"; echo "<label for='rp-3'>" . _("Neither") . "</label>"; display_hiddens($projectid_, $from_image_, $page_name_handling, $transfer_notifications, $add_deletion_reason, $merge_wordcheck_files); echo "<input type='hidden' name='action' value='showagain'>\n";