Programming Questions

  • Newest
  • Popular Tags
  • Ask A Question
  • Simple Symbols in PHP
    Why doesn't the interpreter accept this code? When I try it at home, everything works swell.
    <?php 
    
    function SimpleSymbols($str) {
    	$len = strlen($str);
    	for($i = 0; $i < $len; $i++)
    	{
    		if (ctype_alpha($str[$i]) == true)
    		{
    			if ($str[$i+1] != '+' || $str[$i-1] != '+')
    			{
    				return false;
    			}
    		}
    	}
    	// code goes here
    	return true;     
    }
    
    
       
    // keep this function call here  
    // to see how to enter arguments in PHP scroll down
    echo SimpleSymbols(fgets(fopen('php://stdin', 'r')));  
    
    ?>
    
    trangor asked this question on 11/24/15 | php, symbols
    Answers
  • +
  • 0
  • -
  • Yes, that was the solution. Thank you!
  • +
  • 0
  • -
  • Hi trangor, Sorry about the issue, you have to return the string "true" or "false".
    Login to write an answer