note 16041 added to function.sscanf

From: Date: Sun, 14 Oct 2001 07:25:24 +0000
Subject: note 16041 added to function.sscanf
Groups: php.notes 
Request: Send a blank email to php-notes+get-18898@lists.php.net to get a copy of this message
apparently, sscanf always splits at spaces, even if spaces are not specified in the format. consider this script: <?php $str = "This is a\tsentence with\ttabs"; $scanned = sscanf($str, "%s\t%s\t%s"); echo join(" : ", $scanned); ?> this echoes "This : is : a", not the expected "This is a : sentence with : tabs." this behaviour is fine if your strings don't contain spaces, but if they do you'd be better off using explode(). -- http://www.php.net/manual/en/function.sscanf.php http://master.php.net/manage/user-notes.php?action=edit+16041 http://master.php.net/manage/user-notes.php?action=delete+16041 http://master.php.net/manage/user-notes.php?action=reject+16041

« previous php.notes (#18898) next »