1--TEST-- 2Test sscanf() function : basic functionality - char format 3--FILE-- 4<?php 5 6echo "*** Testing sscanf() : basic functionality - using char format ***\n"; 7 8$str = "X = A + B - C"; 9$format = "%c = %c + %c - %c"; 10 11echo "\n-- Try sccanf() WITHOUT optional args --\n"; 12// extract details using short format 13list($arg1, $arg2, $arg3, $arg4) = sscanf($str, $format); 14var_dump($arg1, $arg2, $arg3, $arg4); 15 16echo "\n-- Try sccanf() WITH optional args --\n"; 17// extract details using long format 18$res = sscanf($str, $format, $arg1, $arg2, $arg3, $arg4); 19var_dump($res, $arg1, $arg2, $arg3, $arg4); 20 21?> 22--EXPECT-- 23*** Testing sscanf() : basic functionality - using char format *** 24 25-- Try sccanf() WITHOUT optional args -- 26string(1) "X" 27string(1) "A" 28string(1) "B" 29string(1) "C" 30 31-- Try sccanf() WITH optional args -- 32int(4) 33string(1) "X" 34string(1) "A" 35string(1) "B" 36string(1) "C" 37