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
Post a Comment