Note that there are some explanatory texts on larger screens.

plurals
  1. POcheck preg_match results against other values?
    text
    copied!<p>I need some help with my PHP script. So, here is the deal.</p> <p>I have a preg_match which checks for the following text in a .txt file that changes every 30minutes or so: LYBE_TWR,LYBE_APP,LYBA_CTR,LYPG_TWR,LYPG_APP,LYTV_TWR,LYNI_APP)</p> <p>It runs perfectly and gets the above strings if they are present.</p> <p>But I need to do even further and check which of the seven combinations have been found because not all are present at all times. Example: The current text file contains LYBE_TWR, LYBE_APP, LYPG_TWR. The preg_match does its thing and I can echo the 3 values but I need this.</p> <pre><code>LYBE_TWR : PRESENT/NOT PRESENT LYBE_APP: PRESENT/NOT PRESENT LYBA_CTR PRESENT/NOT PRESENT LYPG_TWR PRESENT/NOT RESENT etc. </code></pre> <p>So if it is found in the text file it echos present, if not it echoes not present. The correct results would be:</p> <pre><code>LYBE_TWR : PRESENT LYBE_APP: PRESENT LYBA_CTR NOT PRESENT LYPG_TWR PRESENT </code></pre> <p>If I do for example <code>if ($string == "LYBE_TWR") { echo 'present'; } else { echo 'not present'}</code> it will echo the correct value for the <code>LYBE_TWR</code> but it will say not present for the later as they are not actually the one I if-ed for.</p> <p>I hope you understand as I myself am not sure anymore (rofl)</p> <p>edit: here is the current code..bare in mind it is still WIP so not finished and there will be some errors <a href="http://pastebin.com/z1r4A78E" rel="nofollow">http://pastebin.com/z1r4A78E</a> Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload