note 71620 added to function.stream-select

From: Date: Fri, 08 Dec 2006 03:53:40 +0000
Subject: note 71620 added to function.stream-select
Groups: php.notes 
Request: Send a blank email to php-notes+get-120416@lists.php.net to get a copy of this message
Note that contrary to what the previous poster said, one is not able to use a stream resource as a key for an array. Rather, if you want to know which socket you are dealing with, consider using code similar to this: <?php $sockets = array("sock_1" => $sock1, "sock_2" => $sock2, "sock_3" => $sock_3); $read = $write = $error = $sockets; $num = stream_select($read, $write, $error, 10); if ($n > 0) { foreach ($read as $r) { $key = array_search($r, $sockets); // $key will be "sock_1", "sock_2", "sock_3", etc. } } ?> Hope that helps someone out there! ---- Server IP: 203.16.234.19 Probable Submitter: 203.34.184.2 ---- Manual Page -- http://www.php.net/manual/en/function.stream-select.php Edit -- https://master.php.net/note/edit/71620 Del: integrated -- https://master.php.net/note/delete/71620/integrated Del: useless -- https://master.php.net/note/delete/71620/useless Del: bad code -- https://master.php.net/note/delete/71620/bad+code Del: spam -- https://master.php.net/note/delete/71620/spam Del: non-english -- https://master.php.net/note/delete/71620/non-english Del: in docs -- https://master.php.net/note/delete/71620/in+docs Del: other reasons-- https://master.php.net/note/delete/71620 Reject -- https://master.php.net/note/reject/71620 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120416) next »