We have a choice of the following types:
Cast Type Description Alias Method
ALNUM Alphanumeric string; can include A-Z, a-z, and 0-9. ??”??”??”??”
ARRAY Array. ??”??”??”??”
BASE64 Base64 string; can include A-Z, a-z, 0-9, forward
slashes, plus signs, and equal signs. ??”??”??”??”
BOOL / BOOLEAN Boolean value. getBool()
Error Handling and Security
[ 316 ]
Cast Type Description Alias Method
CMD
String syuitable for use as a command; can include
A-Z, a-z, 0-9, underscores, fullstops, and dashes.
getCmd()
FLOAT / DOUBLE Floating-point number. getFloat()
INT / INTEGER Whole number. getInt()
PATH File system path. ??”??”??”??”
STRING
String; this will attempt to decode any special
characters.
getString()
WORD
String with no spaces; can include A-Z, a-z, and
underscores.
getWord()
In this example we cast the value to an integer:
$id = JRequest::getVar('id', 0, 'POST', 'INT');
The trouble with the cast type parameter is that we must specify a default value
and the hash before we can specify the type.
Pages:
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433