1--TEST-- 2Test sscanf() function : basic functionality - float format 3--FILE-- 4<?php 5 6echo "*** Testing sscanf() : basic functionality -- using float format ***\n"; 7 8$str = "Part: Widget Length: 111.53 Width: 22.345 Depth: 12.4"; 9$format = "Part: %s Length: %f Width: %f Depth: %f"; 10 11echo "\n-- Try sccanf() WITHOUT optional args --\n"; 12// extract details using short format 13list($part, $length, $width, $depth) = sscanf($str, $format); 14var_dump($part, $length, $width, $depth); 15 16echo "\n-- Try sccanf() WITH optional args --\n"; 17// extract details using long format 18$res = sscanf($str, $format, $part, $length, $width, $depth); 19var_dump($res, $part, $length, $width, $depth); 20 21?> 22--EXPECT-- 23*** Testing sscanf() : basic functionality -- using float format *** 24 25-- Try sccanf() WITHOUT optional args -- 26string(6) "Widget" 27float(111.53) 28float(22.345) 29float(12.4) 30 31-- Try sccanf() WITH optional args -- 32int(4) 33string(6) "Widget" 34float(111.53) 35float(22.345) 36float(12.4) 37