A
A
Azat Kiberov2019-09-11 21:01:52
PHP
Azat Kiberov, 2019-09-11 21:01:52

How to swap words in a line inside a txt file?

Faced with a problem, you need to swap words inside the txt file
$baza = file("baza2.txt");///file connection
1 line
site.ru ///inside baza2.txt
2 line
site2.ru ///inside baza2. txt
echo trim($baza[0]);//show the first line of the file
echo trim($baza[1]);//show the second line of the file
How to swap
site.ru
site2.ru
It needs to become
site2.ru
site. en

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question