Roman Balakirev
Roman Balakirev

Reputation: 11

Strange result of stripos function

I run this code:

var_dump(stripos($virtualhost[1], "cold="));
echo '----------------------<br>';
var_dump($virtualhost[1]);

And I get the following result:

bool(false)
----------------------<br>
string(206) "<virtual-mta vmta1-cold=\"\">
bla-bla-bla\"

As you can see, the first var_dump directly contradicts the second. What can this be connected with, and how to avoid or circumvent this?

UPD (closer to reality): <virtual-mta vmta1-cold=""> <domain *=""> dkim-sign yes dkim-algorithm rsa-sha256 max-msg-rate 1000000/d max-cold-virtual-mta-msg 1000000/d </domain> smtp-source-host there is a certain IP there is a certain domain </virtual-mta>

Upvotes: 1

Views: 48

Answers (1)

Roman Balakirev
Roman Balakirev

Reputation: 11

For those who are experiencing a similar problem.

In my case, perhaps the point was that I got my array from the contents of the file, which, in turn, was received from the ssh-stream. Here's what I did: I saved this file to local hosting and opened it in notepad. And I saw that the contents of the file are different from my output!

Where I have <virtual-mta vmta1-cold=""> There was a local file <virtual-mta vmta1-cold> ... and a few more differences.

My goal was to identify the paragraphs, where after vmta comes this 'cold'. Then I decided to start from the contents of the local file and instead of looking for the cold= fragment I started looking for the -cold> fragment. And it worked.

Upvotes: 0

Related Questions