1--TEST-- 2file() on a file with blank lines 3--WHITESPACE_SENSITIVE-- 4--FILE-- 5<?php 6 7$filepath = __DIR__ . '/file_variation_7.tmp'; 8$fd = fopen($filepath, "w+"); 9fwrite($fd, "Line 1\n\n \n \n\Line 3"); 10fclose($fd); 11 12echo "file():\n"; 13var_dump(file($filepath)); 14 15echo "\nfile() with FILE_IGNORE_NEW_LINES:\n"; 16var_dump(file($filepath, FILE_IGNORE_NEW_LINES)); 17 18echo "\nfile() with FILE_SKIP_EMPTY_LINES:\n"; 19var_dump(file($filepath, FILE_SKIP_EMPTY_LINES)); 20 21echo "\nfile() with FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES:\n"; 22var_dump(file($filepath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)); 23 24 25?> 26--CLEAN-- 27<?php 28$filepath = __DIR__ . '/file_variation_7.tmp'; 29unlink($filepath); 30?> 31--EXPECT-- 32file(): 33array(5) { 34 [0]=> 35 string(7) "Line 1 36" 37 [1]=> 38 string(1) " 39" 40 [2]=> 41 string(2) " 42" 43 [3]=> 44 string(3) " 45" 46 [4]=> 47 string(7) "\Line 3" 48} 49 50file() with FILE_IGNORE_NEW_LINES: 51array(5) { 52 [0]=> 53 string(6) "Line 1" 54 [1]=> 55 string(0) "" 56 [2]=> 57 string(1) " " 58 [3]=> 59 string(2) " " 60 [4]=> 61 string(7) "\Line 3" 62} 63 64file() with FILE_SKIP_EMPTY_LINES: 65array(5) { 66 [0]=> 67 string(7) "Line 1 68" 69 [1]=> 70 string(1) " 71" 72 [2]=> 73 string(2) " 74" 75 [3]=> 76 string(3) " 77" 78 [4]=> 79 string(7) "\Line 3" 80} 81 82file() with FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES: 83array(4) { 84 [0]=> 85 string(6) "Line 1" 86 [1]=> 87 string(1) " " 88 [2]=> 89 string(2) " " 90 [3]=> 91 string(7) "\Line 3" 92} 93