From 99312394a7469873402305c6422f2a99c388a8bb Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Sat, 15 Feb 2020 22:36:03 +0100 Subject: [PATCH] Update examples --- examples/check.php | 6 ++--- examples/chmod.php | 2 +- examples/debug_timer.php | 6 +++-- examples/fingerd.php | 8 +++--- examples/fs.php | 4 +-- examples/fs_poll.php | 8 +++--- examples/fs_truncate.php | 11 ++++---- examples/fsevent.php | 4 +-- examples/fstat.php | 6 ++--- examples/fsw.php | 21 ++++++++------- examples/getaddrinfo.php | 2 +- examples/gethostbyname.php | 14 ---------- examples/idle.php | 2 +- examples/lstat.php | 4 +-- examples/mkdir.php | 2 +- examples/pipe.php | 4 +-- examples/pipe_bind_connect.php | 16 +++++++----- examples/poll.php | 8 +++--- examples/prepare.php | 4 +-- examples/readdir.php | 4 +-- examples/readlink.php | 3 +-- examples/rename.php | 2 +- examples/request.php | 48 ---------------------------------- examples/rmdir.php | 2 +- examples/sendfile.php | 6 ++--- examples/spawn.php | 2 +- examples/spawn_fd.php | 9 +++---- examples/stat.php | 4 +-- examples/tcp_bind.php | 10 +++---- examples/tcp_bind6.php | 2 +- examples/timer.php | 4 +-- examples/tty.php | 4 +-- examples/udp_bind.php | 6 ++--- examples/unlink.php | 2 +- examples/utime.php | 5 ++-- 35 files changed, 92 insertions(+), 153 deletions(-) delete mode 100644 examples/gethostbyname.php delete mode 100644 examples/request.php diff --git a/examples/check.php b/examples/check.php index 43c2fcc..aa63aaa 100644 --- a/examples/check.php +++ b/examples/check.php @@ -5,7 +5,7 @@ $check = uv_check_init($loop); $idle = uv_idle_init(); $i = 0; -uv_idle_start($idle, function($stat) use (&$i, $idle, $loop){ +uv_idle_start($idle, function($status) use (&$i, $idle, $loop){ echo "count: {$i}" . PHP_EOL; $i++; @@ -15,8 +15,8 @@ uv_idle_start($idle, function($stat) use (&$i, $idle, $loop){ sleep(1); }); -uv_check_start($check, function($check, $status){ - echo "Hello"; +uv_check_start($check, function($check) { + echo "Hello\n"; uv_check_stop($check); }); diff --git a/examples/chmod.php b/examples/chmod.php index 7333f81..310f603 100644 --- a/examples/chmod.php +++ b/examples/chmod.php @@ -1,6 +1,6 @@ UV::AF_UNSPEC )); diff --git a/examples/gethostbyname.php b/examples/gethostbyname.php deleted file mode 100644 index d8e67cd..0000000 --- a/examples/gethostbyname.php +++ /dev/null @@ -1,14 +0,0 @@ - array( - "8.8.8.8" - ), - "port"=>53 -),null); - -ares_gethostbyname($uv,"google.com",AF_INET, function($name, $addr){ - var_dump($name); - var_dump($addr); -}); - -uv_run(); diff --git a/examples/idle.php b/examples/idle.php index 12ac8d4..d0ba178 100644 --- a/examples/idle.php +++ b/examples/idle.php @@ -3,7 +3,7 @@ $loop = uv_default_loop(); $idle = uv_idle_init(); $i = 0; -uv_idle_start($idle, function($stat) use (&$i, $idle, $loop){ +uv_idle_start($idle, function($stat) use (&$i, $idle, $loop) { echo "count: {$i}" . PHP_EOL; $i++; diff --git a/examples/lstat.php b/examples/lstat.php index bd6bdbb..0b28335 100644 --- a/examples/lstat.php +++ b/examples/lstat.php @@ -1,7 +1,7 @@ array( - "8.8.8.8" - ), - "port"=>53 -),null); - -ares_gethostbyname($uv,$domain, AF_INET, function($name, $addr) use ($path, $host){ - $a = array_shift($addr); - $address = uv_ip4_addr($a,"80"); - $tcp = uv_tcp_init(); - - uv_tcp_connect($tcp, $address, function($client, $stat) use ($path, $host){ - var_dump(uv_tcp_getpeername($client)); - - $request = <<"hello"), +uv_spawn(uv_default_loop(), "php", ['-r', 'var_dump($_ENV);'], $stdio, "/usr/bin/", + ["key" => "hello"], function($process, $stat, $signal){ uv_close($process,function(){}); -}, $flags); + }, $flags); - -uv_run(); \ No newline at end of file +uv_run(); diff --git a/examples/stat.php b/examples/stat.php index d3cefcf..f8948f7 100644 --- a/examples/stat.php +++ b/examples/stat.php @@ -1,7 +1,7 @@