function convert_to_null($input) { if (convert_to_bool($input) === false || $input === 'null') { return null; } return $input; }
function convert_to_null($input) { //ensure the string 'null' is converted to null if ($input === 'null') { $input = null; } return convert_to_bool($input) ? $input : null; }
/** * @dataProvider boolTestData */ public function testConvertToBool($value, $expected) { $this->assertSame($expected, convert_to_bool($value)); }