PHP code examples

Updated: 12 March 2024

Read contents of text file into a variable

$file_pointer = fopen('raw_bb_sample.txt', 'r') or die('Unable to open file!');
$sample = fread($file_pointer, filesize('raw_bb_sample.txt'));
fclose($file_pointer);
var_dump($sample);

Leave a comment