Intro to Tutorial Challenges

  • + 1 comment
    <?php
    $_fp = fopen("php://stdin", "r");
    `$v=fgets($`_fp);
    `$n=fgets($`_fp);
    `$a=fgets($`_fp);
    `$ar=split(" ",$`a);
    sort($ar);
    for(`$i=0;$`i<`$n;$`i++){
     if (`$v==$`ar[`$i]){$`num=$i;};}
    print $num;
    fclose($_fp);
    ?>
    

    output says no response but when i change like this

    if (4==`$ar[$`i]){`$num=$`i;};}
    

    then it returns value of $i.. (test case0)

    what is the problem???