Thursday 26 June 2014

Can you find error in following PHP code

Posted by Unknown | 23:07 Categories: ,
Hello friends ....

PHP,PHP code,



here is a simple PHP code to choose a random number and display its square root.

<html>
<head><title>Random</title></head>
<body>
<p>I have randomly selected the number <?php
    choice = rand(1, 100);
    echo $choice;
?>. Its square root is <?php
    echo sqr($choice);
?>.<p>
</body>
</html>


can you find any error in this program.....

reply......


regards : m2soft solutions Pvt. Ltd.

6 comments:

  1. there is no $ sign in declaring a variable

    ReplyDelete
  2. there are more mistakes in the program,.....

    ReplyDelete
    Replies
    1. sqrt($choice); you are calling sqr which is not function

      Delete
    2. yes that's right but there is one more mistake.... find out....

      Delete
    3. line 5 $choice not choice
      line 7 sqrt not sqr

      https://www.youtube.com/channel/UCVd5QKIss6Kka504YFt06gQ

      Delete
    4. thanks for reply.... thats right....

      Delete

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube