D
D
damarkuzz2021-04-28 17:01:58
PHP
damarkuzz, 2021-04-28 17:01:58

How to substitute a new value into a variable from the lines of a file using PHP?

There is a file sku.txt. Each new line in it contains a specific article. Tell me how to make a substitute for a cycle in a value $id,that is equal to one line in order from the file sku.txt? The following after the inscription must be executed in the cycle// Loading page команды.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Yuriev, 2021-04-28
@damarkuzz

https://www.php.net/manual/ru/function.fgets.php

A
AUser0, 2021-04-28
@AUser0

foreach(file("sku.txt") as $id) {echo(trim($id)."\n");}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question