SPL Type HandlingInhaltsverzeichnis
The SplType classEinführungParent class for all SPL types. KlassenbeschreibungSplType
abstract class SplType
{
/* Constants */
const
NULL
SplType::__default
= null
;
/* Methoden */
__construct
([ mixed
}$initial_value
[, bool $strict
]] )Vordefinierte Konstanten
The SplInt classEinführungThe SplInt class is used to enforce strong typing of the integer type. KlassenbeschreibungSplInt
class SplInt
extends
SplType
{
/* Constants */
const
integer
SplInt::__default
= 0
;
/* Geerbte Methoden */
SplType::__construct
([ mixed
}$initial_value
[, bool $strict
]] )Vordefinierte Konstanten
Beispiele
Beispiel #1 SplInt usage example
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe: Value not an integer 94 The SplFloat classEinführungThe SplFloat class is used to enforce strong typing of the float type. KlassenbeschreibungSplFloat
class SplFloat
extends
SplType
{
/* Constants */
const
float
SplFloat::__default
= 0
;
/* Geerbte Methoden */
SplType::__construct
([ mixed
}$initial_value
[, bool $strict
]] )Vordefinierte Konstanten
Beispiele
Beispiel #2 SplFloat usage example
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe: Value not a float 3.154 3 Die Klasse SplEnumEinführungSplEnum bietet die Möglichkeit Aufzählungen (Enums) und Enum-Objekte nativ in PHP zu erstellen. KlassenbeschreibungSplEnum
class SplEnum
extends
SplType
{
/* Constants */
const
NULL
SplEnum::__default
= null
;
/* Methoden */
public array getConstList
([ bool
$include_default = false
] )/* Geerbte Methoden */
SplType::__construct
([ mixed
}$initial_value
[, bool $strict
]] )Vordefinierte Konstanten
Beispiele
Beispiel #3 SplEnum Verwendungsbeispiel
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe: 6 Value not a const in enum Month The SplBool classEinführungThe SplBool class is used to enforce strong typing of the bool type. KlassenbeschreibungSplBool
class SplBool
extends
SplEnum
{
/* Constants */
const
boolean
SplBool::__default
= false
;
const
boolean
SplBool::false
= false
;
const
boolean
SplBool::true
= true
;
/* Geerbte Methoden */
public array SplEnum::getConstList
([ bool
}$include_default = false
] )Vordefinierte Konstanten
Beispiele
Beispiel #1 SplBool usage example
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe: TRUE The SplString classEinführungThe SplString class is used to enforce strong typing of the string type. KlassenbeschreibungSplString
class SplString
extends
SplType
{
/* Constants */
const
string
SplString::__default
= ''
;
/* Geerbte Methoden */
SplType::__construct
([ mixed
}$initial_value
[, bool $strict
]] )Vordefinierte Konstanten
Beispiele
Beispiel #2 SplString usage example
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe:
Value not a string
object(SplString)#1 (1) {
["__default"]=>
string(7) "Testing"
}
Testing
|