how to close warnings in php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    how to close warnings in php

    hi,
    i am using array_reverse() function to reverse an array but it is giving me ths warning,how can i close this warning message
    array_reverse() [function.array-reverse]: The argument should be an array in D:\xampp\htdocs \kashafprojects \temp\menu.php on line 63
    regards,
    Omer Aslam
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    Originally posted by omerbutt
    hi,
    i am using array_reverse() function to reverse an array but it is giving me ths warning,how can i close this warning message
    array_reverse() [function.array-reverse]: The argument should be an array in D:\xampp\htdocs \kashafprojects \temp\menu.php on line 63
    regards,
    Omer Aslam
    you have error_reporting turned on to E_ALL. Turn this off whereever it is set (in php.ini or in your code)

    you should probably listen to the warning. make sure you're passing it an array by applying is_array() to the variable.

    thanks,






    Dan

    Comment

    • Dormilich
      Recognized Expert Expert
      • Aug 2008
      • 8694

      #3
      Originally posted by dlite922
      you have error_reporting turned on to E_ALL. Turn this off whereever it is set (in php.ini or in your code)
      well, in my opinion it's not advisable to turn your back to warnings (i.e. turning them off), since they are often followed by an error. better correct the code than ignore a warning.

      regards

      Comment

      • dlite922
        Recognized Expert Top Contributor
        • Dec 2007
        • 1586

        #4
        Originally posted by Dormilich
        well, in my opinion it's not advisable to turn your back to warnings (i.e. turning them off), since they are often followed by an error. better correct the code than ignore a warning.

        regards
        ...hence my second reply:

        Originally posted by dlite922
        you should probably listen to the warning. make sure you're passing it an array by applying is_array() to the variable.
        :D

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #5
          I just wanted to emphasize that turning off E_WARNING in php.ini or ini_set() or .htaccess doesn't seem right.

          anyways, good code doesn't produce warnings.

          Comment

          • Markus
            Recognized Expert Expert
            • Jun 2007
            • 6092

            #6
            You can suppress an error by using the '@' symbol. Error control.

            Also, you shouldn't leave error reporting on for a site that is going live - for development, it's fine, but otherwise just log the errors; wouldn't want a passing user to catch sensitive data from an error. Ooops.

            Comment

            • Dormilich
              Recognized Expert Expert
              • Aug 2008
              • 8694

              #7
              Originally posted by Markus
              wouldn't want a passing user to catch sensitive data from an error. Ooops.
              that's true, good error handling is a great help there.

              Comment

              Working...