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
Compare revisions
4d1bcb5becbef1136f6e7424b23386f335d953b8 to fb346737292b84e5371d732f21d4271c4db8e4fa
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
a.shamavov/tasks-php
Select target project
No results found
fb346737292b84e5371d732f21d4271c4db8e4fa
Select Git revision
Swap
Target
a.shamavov/tasks-php
Select target project
a.shamavov/tasks-php
1 result
4d1bcb5becbef1136f6e7424b23386f335d953b8
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (4)
add readLogFile
· 42ee1495
Адлан Шамавов
authored
11 months ago
42ee1495
add readFileLineByLine
· 69cf4ad1
Адлан Шамавов
authored
11 months ago
69cf4ad1
Merge branch 'PTPS_Function_1' into PTPS_Function_8
· 2efab432
Адлан Шамавов
authored
11 months ago
2efab432
fix
· fb346737
Адлан Шамавов
authored
11 months ago
fb346737
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
files/text.txt
+2
-0
2 additions, 0 deletions
files/text.txt
index.php
+0
-7
0 additions, 7 deletions
index.php
src/Functions.php
+0
-26
0 additions, 26 deletions
src/Functions.php
with
2 additions
and
33 deletions
files/text.txt
0 → 100644
View file @
fb346737
Раз, два, три, четыре,
Пять, шесть, семь, восемь.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
index.php
View file @
fb346737
...
...
@@ -93,12 +93,5 @@ $func = new Hp\Test\Functions();
<?php
$func
->
readLogFile
(
__DIR__
.
"/public/text.txt"
);
?>
<h1>
Function 9
</h1>
<?php
foreach
(
$func
->
readFileLineByLine
(
__DIR__
.
"/public/text.txt"
)
as
$line
)
{
print
(
$line
);
}
?>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/Functions.php
View file @
fb346737
...
...
@@ -155,13 +155,6 @@ class Functions {
return
$dateInterval
->
format
(
"%a"
)
;
}
/**
* Переделай своё решение 8 задачи:
* замени вывод всего текста из файла разом на
* построчный вывод используя yield
* @param string $filePath путь до файла
* @return void
*/
function
readLogFile
(
string
$filePath
):
void
{
if
(
file_exists
(
$filePath
))
{
$text
=
""
;
...
...
@@ -175,24 +168,5 @@ class Functions {
}
else
print
(
"Такого файла не существует."
);
}
/**
* Переделай своё решение 8 задачи:
* замени вывод всего текста из файла разом на
* построчный вывод используя yield
* @param string $filePath путь до файла
* @return void
*/
function
readFileLineByLine
(
string
$filePath
):
iterable
{
if
(
file_exists
(
$filePath
))
{
$file
=
fopen
(
$filePath
,
"r"
);
while
(
!
feof
(
$file
))
{
yield
fgets
(
$file
);
}
fclose
(
$file
);
}
else
yield
"Такого файла не существует."
;
}
}
This diff is collapsed.
Click to expand it.