tags:

views:

35

answers:

2

What do @ and (int) do in the following.

$id=(int)@$_REQUEST['id'];
+2  A: 

@ supressess errors, and (int) casts to the type Integer.

  1. Error-control Operator
  2. Type-Juggling
Jonathan Sampson
Do you know what the value of `$id` would be if `$_REQUEST` has no value with key `'id'`?
Dominic Rodger
it would raise a notice, more precisely.
pixeline
And the value would be 0
Vinko Vrsalovic
A: 

(int) is converting whatever the value of $_REQUEST['id'] into an integer (this is called casting).

pixeline