Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
18
Task/File-input-output/PHP/file-input-output-1.php
Normal file
18
Task/File-input-output/PHP/file-input-output-1.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
if (!$in = fopen('input.txt', 'r')) {
|
||||
die('Could not open input file.');
|
||||
}
|
||||
|
||||
if (!$out = fopen('output.txt', 'w')) {
|
||||
die('Could not open output file.');
|
||||
}
|
||||
|
||||
while (!feof($in)) {
|
||||
$data = fread($in, 512);
|
||||
fwrite($out, $data);
|
||||
}
|
||||
|
||||
fclose($out);
|
||||
fclose($in);
|
||||
?>
|
||||
9
Task/File-input-output/PHP/file-input-output-2.php
Normal file
9
Task/File-input-output/PHP/file-input-output-2.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
if ($contents = file_get_contents('input.txt')) {
|
||||
if (!file_put_contents('output.txt', $contents)) {
|
||||
echo('Could not write output file.');
|
||||
}
|
||||
} else {
|
||||
echo('Could not open input file.');
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue