Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tasks-php
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Адлан Шамавов
tasks-php
Commits
6e44c093
Commit
6e44c093
authored
11 months ago
by
Адлан Шамавов
Browse files
Options
Downloads
Plain Diff
fixes
parents
fb346737
62ab1944
No related branches found
Branches containing commit
No related tags found
1 merge request
!8
Ptps function 8
This commit is part of merge request
!9
. Comments created here will be created in the context of that merge request.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
index.php
+22
-27
22 additions, 27 deletions
index.php
with
22 additions
and
27 deletions
index.php
+
22
−
27
Edit
View file @
6e44c093
<?php
require_once
__DIR__
.
'/vendor/autoload.php'
;
$func
=
new
Hp\Test\Functions
();
/**
* Переделай своё решение 8 задачи:
* замени вывод всего текста из файла разом на
* построчный вывод используя yield
* @param string $filePath путь до файла
* @return void
*/
function
readLogFile
(
string
$filePath
):
void
{
if
(
file_exists
(
$filePath
))
{
$text
=
""
;
$file
=
fopen
(
$filePath
,
"r"
);
while
(
!
feof
(
$file
))
{
$line
=
fgets
(
$file
);
$text
.
=
$line
;
}
fclose
(
$file
);
print
(
$text
);
}
else
print
(
"Такого файла не существует."
);
}
?>
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
Document
</title>
</head>
<body>
<h1>
Function 1
</h1>
...
...
@@ -77,21 +86,7 @@ $func = new Hp\Test\Functions();
<h1>
Function 6
</h1>
<?php
print
(
"<h2>Пятницы 13: </h2>"
);
foreach
(
$func
->
countFriday13
(
2024
)
as
$date
)
{
print
(
$date
->
format
(
"Y-m-d l"
)
.
"
\n
"
);
}
?>
<h1>
Function 7
</h1>
<?php
print
(
"<h2>Разница дней: </h2>"
);
print
(
$func
->
diffDays
(
new
DateTimeImmutable
(),
new
DateTimeImmutable
(
"2025-01-01"
)));
?>
<h1>
Function 8
</h1>
<?php
$func
->
readLogFile
(
__DIR__
.
"/public/text.txt"
);
readLogFile
(
__DIR__
.
"/files/text.txt"
);
?>
</body>
</html>
\ No newline at end of file
</html>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment