rewind 


php128 apg

SETS the file position indicator for handle to the beginning of the file stream.





This function returns TRUE on success or FALSE on failure.



<?php

bool rewind 
res $stream )


where,

$stream The valid file pointer opened by fopen

?>

 $stream 


A valid file pointer to a successfully opened such as by the fopen function.



  1 EXERCISE   

<?php

$fl01 
PATH2TPW 'sw7.jpg';

$opts01 = [ 'http' => [ 'method'=>"POST",
          
'header' => "Accept-language: en",
          
'content' => $fl01 ] ]; 

$cntxt01 stream_context_create($opts01);

var_dump($cntxt01);

echo 
'<br><br>';


$fopen01 fopen($fl01"r"false$cntxt01);

rewind($fopen01);
// RESETS THE FILE POINTER TO THE BEGINNING

fclose($fopen01);

?>

 RESULT   

resource(7) of type (stream-context)

This is a particular resource.