typeCast() 공개 정적인 메소드

Convenience function for automatic casting in form methods etc.
public static typeCast ( mixed $value, string $type ) : mixed
$value mixed
$type string
리턴 mixed Safe value for DB query, or NULL if type was not a valid one
예제 #1
0
 /**
  * UtilityTest::testTypeCast()
  *
  * @covers ::typeCast
  * @return void
  */
 public function testTypeCast()
 {
     $res = Utility::typeCast(2, 'string');
     $this->assertNotSame(2, $res);
     $this->assertSame('2', $res);
 }