Re: ran into a seemingly odd problem

From: Date: Sat, 10 Sep 2005 23:20:01 +0000
Subject: Re: ran into a seemingly odd problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-222128@lists.php.net to get a copy of this message
matt VanDeWalle wrote:
function commands($sock, $data) { $word_count = str_word_count($data); $words = str_word_count($data, 1); /* here is where the problems come in I think */ if(($word_count == 2) && ($data == '.quit')) { echo "you quit with a message of $data\n"; } else { echo "quitting without saying anything...\n"; } }
function commands( $sock, $data ) { $words = explode( ' ', $data ); if( count( $words ) == 2 && $words[0] == '.quit' ) { echo "quit with a message of {$words[1]}\n"; } else { echo "quit with no message\n"; } } -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ If you find my advice useful, please consider donating to a poor student! You can choose whatever amount you think my advice was worth to you. http://tinyurl.com/7oa5s

« previous php.general (#222128) next »