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 sizeof() function : object functionality - object with Countable interface -..
Decoded Output download
--TEST--
Test sizeof() function : object functionality - object with Countable interface
--FILE--
<?php
echo "*** Testing sizeof() : object functionality ***
";
echo "-- Testing sizeof() with an object which implements Countable interface --
";
class sizeof_class implements Countable
{
public $member1;
private $member2;
protected $member3;
public function count(): int
{
return 3; // return the count of member variables in the object
}
}
$obj = new sizeof_class();
echo "-- Testing sizeof() in default mode --
";
var_dump( sizeof($obj) );
echo "-- Testing sizeof() in COUNT_NORMAL mode --
";
var_dump( sizeof($obj, COUNT_NORMAL) );
echo "-- Testing sizeof() in COUNT_RECURSIVE mode --
";
var_dump( sizeof($obj, COUNT_RECURSIVE) );
echo "Done";
?>
--EXPECT--
*** Testing sizeof() : object functionality ***
-- Testing sizeof() with an object which implements Countable interface --
-- Testing sizeof() in default mode --
int(3)
-- Testing sizeof() in COUNT_NORMAL mode --
int(3)
-- Testing sizeof() in COUNT_RECURSIVE mode --
int(3)
Done
Did this file decode correctly?
Original Code
--TEST--
Test sizeof() function : object functionality - object with Countable interface
--FILE--
<?php
echo "*** Testing sizeof() : object functionality ***\n";
echo "-- Testing sizeof() with an object which implements Countable interface --\n";
class sizeof_class implements Countable
{
public $member1;
private $member2;
protected $member3;
public function count(): int
{
return 3; // return the count of member variables in the object
}
}
$obj = new sizeof_class();
echo "-- Testing sizeof() in default mode --\n";
var_dump( sizeof($obj) );
echo "-- Testing sizeof() in COUNT_NORMAL mode --\n";
var_dump( sizeof($obj, COUNT_NORMAL) );
echo "-- Testing sizeof() in COUNT_RECURSIVE mode --\n";
var_dump( sizeof($obj, COUNT_RECURSIVE) );
echo "Done";
?>
--EXPECT--
*** Testing sizeof() : object functionality ***
-- Testing sizeof() with an object which implements Countable interface --
-- Testing sizeof() in default mode --
int(3)
-- Testing sizeof() in COUNT_NORMAL mode --
int(3)
-- Testing sizeof() in COUNT_RECURSIVE mode --
int(3)
Done
Function Calls
None |
Stats
MD5 | 1df8c67b8066f1ef8edc6c1b19357ca2 |
Eval Count | 0 |
Decode Time | 95 ms |