Re: ran into a seemingly odd problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux