Regex to check if a number matches

Discussion in 'PHP' started by Tectonicz, Aug 22, 2009.

  1. #1
    What would be the regex term to check if a number matches?

    Like for example:

    <a href="page.php?search=<? echo $search ?>&page=<? echo $previous ?>"> Previous</a> |
    <a href="page.php?search=<? echo $search ?>&page=<? echo $next ?>">Next</a>
    Code (markup):
    $previous and $next are always page numbers.

    How would i determine if $previous matches $next, I should do an str replace so it dont echo. (because their is no next page).
     
    Tectonicz, Aug 22, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Why would you need a regex for that?
    
    <a href="page.php?search=<?php echo $search ?>&page=<?php echo $previous ?>"> Previous</a>
    <?php if ($previous != $next): ?>
     |
    <a href="page.php?search=<?php echo $search ?>&page=<?php echo $next ?>">Next</a>
    <?php endif; ?>
    Code (markup):
     
    premiumscripts, Aug 22, 2009 IP