Asked 3 years ago
19 Jul 2021
Views 455
Jules

Jules posted

how to write to Many Filehandles Simultaneously ?

how to write to Many Filehandles Simultaneously ?
many filehandles means to standarad output , temproary file , to file etc..
rajiv

rajiv
answered Jul 19 '21 00:00


function MultiHandlesWrite($filehandle,$stringtowrite){
for($i=0;$i<=count($filehandle);$i++){
fwrite($filehandle[$i],$stringtowrite);
}
}




Above function will help you to write multi handle same time

you can use like as below , it is used for standand output , temp file and test.txt as we;;



$fps['file'] = fopen('test.txt','w') ;
 $fps['screen'] = fopen('php://stdout','w') ;
 $fps['screen'] = fopen('php://temp','w') ;

MultiHandlesWrite($fps,'This is test to write to differ multi handler in single function ');
Post Answer