Home  >  Q&A  >  body text

God, please help me figure out what's wrong.

<?php $var=22; ?><?phpif ($row['zt']>"0") { echo "222";} else { echo "111";}?> ;

# Why does it display 111 when running like this? It should be 222. That's the mistake.

P粉726632954P粉726632954820 days ago1024

reply all(5)I'll reply

  • autoload

    autoload2022-06-24 15:40:09

    <?php
    $ddd=11;
    if ($ddd >11) 
    echo "222";
    else echo "111";
    ?>

    That’s it

    reply
    0
  • P粉726632954

    P粉7266329542022-06-24 14:57:47

    <?php $ddd=22; ?><?phpif ($row['ddd']>11) { echo "222";} else { echo "111";}?>you OK, brother, I want to display 222 if ddd>11, how to write it. Ask for advice.

    reply
    0
  • autoload

    autoload2022-06-24 09:20:46

    Your idea is weird, why is it the string "0"?

    If comparing strings, the basis is the size of the ASCII code value of the characters from left to right in the string

    And who knows what your $row['zt'] is? , I wrote two pieces of unrelated code. If I run it directly, I will definitely get an error of undefined variable

    reply
    0
  • P粉726632954

    It’s a comparison of numbers. How should we write the numbers?

    P粉726632954 · 2022-06-24 14:44:07
    P粉726632954

    Hello, brother, I want to display 222 if ddd>11, how to write it. Ask for advice.

    P粉726632954 · 2022-06-24 14:57:57
  • Cancelreply