Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Test strncmp() function : error conditions --FILE-- <?php /* Test strncmp() funct..

Decoded Output download

*** Testing strncmp() function: error conditions ***

Did this file decode correctly?

Original Code

--TEST--
Test strncmp() function : error conditions
--FILE--
<?php
/* Test strncmp() function with more/less number of args and invalid args */

echo "*** Testing strncmp() function: error conditions ***\n";
$str1 = 'string_val';
$str2 = 'string_val';

/* Invalid argument for $len */
$len = -10;

try {
    var_dump( strncmp($str1, $str2, $len) );
} catch (\ValueError $e) {
    echo $e->getMessage() . \PHP_EOL;
}

?>
--EXPECT--
*** Testing strncmp() function: error conditions ***
strncmp(): Argument #3 ($length) must be greater than or equal to 0

Function Calls

None

Variables

$len -10
$str1 string_val
$str2 string_val

Stats

MD5 7ad84e47646aff3a474aeb8d24b88845
Eval Count 0
Decode Time 108 ms