how can I use multiple paths in php if statement -


<?php if (preg_match('/\/contact\//', $_server['request_uri']) === 1): ?> <a href="/">link</a> <?php endif; ?> 

i'm trying add multiple folders same statement /contact/ , /news/, content inside statement appear in both folders.

i tried (preg_match('/\/contact\//', '/\/news\//', $_server['request_uri']), returned errors.

what doing wrong?

you can use | (or) operator in regexp.

<?php if (preg_match('/\/(contact|news)\//', $_server['request_uri']) === 1): ?> 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -