1--TEST-- 2Test readfile() function: usage variation - stream_context 3--FILE-- 4<?php 5/* Prototype: int readfile ( string $filename [, bool $use_include_path [, resource $context]] ); 6 Description: Outputs a file 7*/ 8 9/* test readfile() with third argument : context */ 10 11// include file.inc 12require("file.inc"); 13$file_path = __DIR__; 14 15/* Variation 1 : Check working of third argument of readfile() */ 16 17echo "*** Testing readfile(): checking third argument ***\n"; 18// creating a context 19$context = stream_context_create(); 20// temp file name used here 21$filename = "$file_path/readfile_variation1.tmp"; 22 23// create file 24$fp = fopen($filename, "w"); 25fill_file($fp, "text_with_new_line", 50); 26fclose($fp); 27$count = readfile($filename, true, $context); 28echo "\n"; 29var_dump($count); 30 31echo "Done\n"; 32?> 33--CLEAN-- 34<?php 35unlink(__DIR__."/readfile_variation1.tmp"); 36?> 37--EXPECT-- 38*** Testing readfile(): checking third argument *** 39line 40line of text 41line 42line of text 43line 44line of t 45int(50) 46Done 47