Skip to content

Instantly share code, notes, and snippets.

@jaytaph
Created June 1, 2014 15:10
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaytaph/8d0e9b481cdf47e7742e to your computer and use it in GitHub Desktop.
Save jaytaph/8d0e9b481cdf47e7742e to your computer and use it in GitHub Desktop.
<?php
$f = fopen("data.txt", "r");
fread($f, 10);
fread($f, 10);
// Run with: strace -e trace=read php test2.
/*
read(3, "<?php\nclass File {\n \n private $"..., 8192) = 8192
*/
<?php
$f = fopen("data.txt", "r");
stream_set_chunk_size($f, 5);
fread($f, 10);
fread($f, 10);
// Run with: strace -e trace=read php test2.
/*
read(3, "<?php", 5) = 5
read(3, "\nclas", 5) = 5
read(3, "s Fil", 5) = 5
read(3, "e {\n ", 5) = 5
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment