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
Merge requests
!9
Ptps function 9
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Ptps function 9
PTPS_Function_9
into
main
Overview
1
Commits
6
Pipelines
0
Changes
1
1 unresolved thread
Hide all comments
Merged
Адлан Шамавов
requested to merge
PTPS_Function_9
into
main
11 months ago
Overview
1
Commits
6
Pipelines
0
Changes
1
1 unresolved thread
Hide all comments
Expand
0
0
Merge request reports
Viewing commit
6e44c093
Show latest version
1 file
+
22
−
27
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
6e44c093
fixes
· 6e44c093
Адлан Шамавов
authored
11 months ago
index.php
+
22
−
27
Options
<?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>
Loading