PHP preg_replace function returns different values with the same data set

Posted by patryk on Stack Overflow See other posts from Stack Overflow or by patryk
Published on 2012-11-12T22:50:22Z Indexed on 2012/11/12 23:00 UTC
Read the original article Hit count: 394

Filed under:
|

I need to use preg_match PHP function. I have a simple pattern to check the string and the thing is as follows: when I run the script at first, it gives me no match (it is supposed to match though) but when I hold F5 in my browser for a while, out of a sudden it says there's a match within the string. As I keep pushing F5, it gives either true or false. Say the pattern is /^(.*)\/[A-Za-z0-9]*$/ (I guess it's not the best way but still) and the subject is galeria/zdjecia/. I believe preg_match should return true with this set of data. Note that the data does not change when pressing F5. Why is that?

© Stack Overflow or respective owner

Related posts about php

Related posts about preg-match