gammaman Posted May 13, 2008 Share Posted May 13, 2008 Why does this function not work <?php function string($string) { $x=strlen($string); if($x>=6){ return true; }else{ return false; } } $words="This is a String"; string($words); ?> Link to comment https://forums.phpfreaks.com/topic/105418-help-with-strlen-function/ Share on other sites More sharing options...
947740 Posted May 13, 2008 Share Posted May 13, 2008 What is not working? How do you know what the return value is? Are you echoing it? Is it coming out as "false", thefore not working? Link to comment https://forums.phpfreaks.com/topic/105418-help-with-strlen-function/#findComment-539855 Share on other sites More sharing options...
soycharliente Posted May 13, 2008 Share Posted May 13, 2008 string may be a reserved word in PHP. Try naming it something different. Also, what exactly isn't working? You're not echoing anything to the screen. <?php function checkLen($input) { if (strlen($input) >= 6) { return TRUE; } else { return FALSE; } } $words = "This is a string."; echo checkLen($words); ?> Link to comment https://forums.phpfreaks.com/topic/105418-help-with-strlen-function/#findComment-539856 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.