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-- SPL: RegexIterator::getFlags() and setFlags() basic tests --CREDITS-- Felix De Vl..

Decoded Output download

--TEST--
SPL: RegexIterator::getFlags() and setFlags() basic tests
--CREDITS--
Felix De Vliegher <[email protected]>
--FILE--
<?php

$array = array('foo', 'bar', 'baz');
$iterator = new ArrayIterator($array);
$regexIterator = new RegexIterator($iterator, "/f/", RegexIterator::MATCH, RegexIterator::USE_KEY);

var_dump($regexIterator->getFlags() === RegexIterator::USE_KEY);

// Test a change in flags, there's only one class constant so it has to be another int value
$regexIterator->setFlags(3);
var_dump($regexIterator->getFlags() === RegexIterator::USE_KEY);
$regexIterator->setFlags(RegexIterator::USE_KEY);
var_dump($regexIterator->getFlags() === RegexIterator::USE_KEY);

?>
--EXPECT--
bool(true)
bool(false)
bool(true)

Did this file decode correctly?

Original Code

--TEST--
SPL: RegexIterator::getFlags() and setFlags() basic tests
--CREDITS--
Felix De Vliegher <[email protected]>
--FILE--
<?php

$array = array('foo', 'bar', 'baz');
$iterator = new ArrayIterator($array);
$regexIterator = new RegexIterator($iterator, "/f/", RegexIterator::MATCH, RegexIterator::USE_KEY);

var_dump($regexIterator->getFlags() === RegexIterator::USE_KEY);

// Test a change in flags, there's only one class constant so it has to be another int value
$regexIterator->setFlags(3);
var_dump($regexIterator->getFlags() === RegexIterator::USE_KEY);
$regexIterator->setFlags(RegexIterator::USE_KEY);
var_dump($regexIterator->getFlags() === RegexIterator::USE_KEY);

?>
--EXPECT--
bool(true)
bool(false)
bool(true)

Function Calls

None

Variables

$array [{'key': 0, 'value': 'foo'}, {'key': 1, 'value': 'bar'}, {'key': 2, 'value': 'baz'}]

Stats

MD5 c736ecc139d7f4b6785c41559d7f1283
Eval Count 0
Decode Time 105 ms