diff options
-rw-r--r-- | it.class | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -746,19 +746,21 @@ static function mail($p) */ static function file_get($filename, $p = array()) { - $data = file_get_contents($filename == "-" ? "php://stdin" : $filename); - if ($p['keyval'] && $data !== false) + if (($data = file_get_contents($filename == "-" ? "php://stdin" : $filename)) !== false) { - foreach (explode("\n", rtrim($data, "\n")) as $line) + if ($p['keyval']) { - $arr = explode("\t", $line, 2); - $result[$arr[0]] = $arr[1]; + foreach (explode("\n", rtrim($data, "\n")) as $line) + { + $arr = explode("\t", $line, 2); + $result[$arr[0]] = $arr[1]; + } } + else if ($p['lines']) + $result = explode("\n", rtrim($data, "\n")); + else + $result = $data; } - else if ($p['lines']) - $result = $data !== false ? explode("\n", rtrim($data, "\n")) : array(); - else - $result = $data; return $result; } |