1--TEST-- 2Test strncmp() function : usage variations - binary safe(null terminated strings) 3--FILE-- 4<?php 5/* Prototype : int strncmp ( string $str1, string $str2, int $len ); 6 * Description: Binary safe case-sensitive string comparison of the first n characters 7 * Source code: Zend/zend_builtin_functions.c 8*/ 9 10/* Test strncmp() function with binary values passed to 'str1' & 'str2' and with the null terminated strings */ 11 12echo "*** Test strncmp() function: Checking with the null terminated strings ***\n"; 13 14/* A binary function should not expect a null terminated string, and it should treat input as a raw stream of data */ 15$str1 = "Hello\0world"; 16$str2 = "Hello\0"; 17var_dump( strncmp($str1, $str2, 12) ); //expected: int(5); 18 19echo "*** Done ***\n"; 20?> 21--EXPECTF-- 22*** Test strncmp() function: Checking with the null terminated strings *** 23int(5) 24*** Done *** 25