Forum Replies Created

Viewing 1 replies (of 1 total)
  • So your just trying to find out if the string length is 0 or empty correct?

    If so you may want to swap them around because I see here that it may assume your $string is a non numeric character and return false when compared to “0” or “0” will be also used as ” ” an empty space. Nothing compared to something will return a false.

    Lets define the Variable $string to store here:
    $string = "Your String Goes Here!";

    Lets check if the string is empty or equal to 0 here.

       if( strlen( $string == "0" ) ){
      return "";
    }
     else{
      return $string;
    }

    or

       if( empty( $string ) ){
      return "";
    }
     else{
      return $string;
    }

    or

       if( !$string ){
      return "";
    }
     else{
      return $string;
    }

    Remember that if for some reason the Var $string is empty, ”, “”, 0 or “0” they will be read as empty or “0”.

    Give those a try. if the error goes away and the string does not output or return try replacing:
    return $string;
    With
    echo $string;

    Hope that helped!

    • This reply was modified 7 years, 1 month ago by kwikfiks. Reason: Caught something I did wrong while previewing the post
Viewing 1 replies (of 1 total)