Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How do I get the number of "if"s in a string? (php)  (Read 3007 times)

0 Members and 1 Guest are viewing this topic.

Bannana97

    Topic Starter


    Intermediate
  • Owner of HerbertsWorld Corporation
    How do I get the number of "if"s in a string? (php)
    « on: June 14, 2009, 09:35:39 AM »
    Code: [Select]
    <?php
    $check 
    $_POST['code'];
    $numifs 0;

    // Right here..
    // How do I check how many "if"s are in $check? 
    $numifs // Number found ^^
    ?>

    Thanks
    Bannana97

    kpac

    • Web moderator
    • Moderator


    • Hacker

    • kpac®
    • Thanked: 184
      • Yes
      • Yes
      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 7
    Re: How do I get the number of "if"s in a string? (php)
    « Reply #1 on: June 14, 2009, 12:14:16 PM »
    Use the preg_match function: http://www.php.net/manual/en/function.preg-match.php

    Have a look at the examples.