Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: strlen in if

  1. #1
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts

    strlen in if

    Hi people,
    what is the correct way to use strlen() in an if statement?

    PHP Code:
    if (isset($_POST['message']) && (strlen($_POST['message'] => 20))){ 
    resulting in
    Code:
    Parse error: syntax error, unexpected T_DOUBLE_ARROW in DIRTOFILE/file.php on line 63
    Thanks in advance
    Jamie West.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by rafiki View Post
    Hi people,
    what is the correct way to use strlen() in an if statement?
    PHP Code:
    if (isset($_POST['message']) && (strlen($_POST['message']) >= 20)){ 

  • Users who have thanked Inigoesdr for this post:

    rafiki (02-29-2008)

  • #3
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    doh stupid me, its been a while, thanks ini

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    This type of stuff is in the manual btw...
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    thing is i shouldn't of needed to look in the manual. school boys mistake thats the the only one today though


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •