Answer the question
In order to leave comments, you need to log in
How to delete a string inside an array that is in a constant?
I do the removal of all lines from the array if a match is found with my condition.
If I try to remove a line from the array through the unset () function and use ordinary variables, then everything works fine, if I use constants, then it writes errors.
As I found out, the error is written because the functions that I use to work with an array only support variables, if I try to use a constant, it writes an error.
define("MASIV", file('MASIV.txt');
foreach (MASIV as $key => $value) {
if (MASIV[$key] == 'СОВПАДЕНИЕ') {
unset(MASIV[$key]);
file_put_contents('MASIV.txt', implode(PHP_EOL, MASIV));
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question