3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $mixed = array( 3, 3.4889211135, 3,88903098292, "3", "3.4889211135", "3,88903098292", 0, "0", false, "false", true, null, "?", "1.000,31", "1,000.31", "1,000.31", "1.000,31 USD", ); foreach ($mixed as $value) { printf("`var_dump( %s )` gives:" . PHP_EOL, $value); var_dump($value); printf("`var_dump( intval(%s) )` gives:" . PHP_EOL, $value); var_dump(@intval($value)); printf("`var_dump( (int)%s )` gives:" . PHP_EOL, $value); var_dump(@intval($value)); print "---------------------------------" . PHP_EOL; }
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
`var_dump( 3 )` gives: int(3) `var_dump( intval(3) )` gives: int(3) `var_dump( (int)3 )` gives: int(3) --------------------------------- `var_dump( 3.4889211135 )` gives: float(3.4889211135) `var_dump( intval(3.4889211135) )` gives: int(3) `var_dump( (int)3.4889211135 )` gives: int(3) --------------------------------- `var_dump( 3 )` gives: int(3) `var_dump( intval(3) )` gives: int(3) `var_dump( (int)3 )` gives: int(3) --------------------------------- `var_dump( 88903098292 )` gives: int(88903098292) `var_dump( intval(88903098292) )` gives: int(88903098292) `var_dump( (int)88903098292 )` gives: int(88903098292) --------------------------------- `var_dump( 3 )` gives: string(1) "3" `var_dump( intval(3) )` gives: int(3) `var_dump( (int)3 )` gives: int(3) --------------------------------- `var_dump( 3.4889211135 )` gives: string(12) "3.4889211135" `var_dump( intval(3.4889211135) )` gives: int(3) `var_dump( (int)3.4889211135 )` gives: int(3) --------------------------------- `var_dump( 3,88903098292 )` gives: string(13) "3,88903098292" `var_dump( intval(3,88903098292) )` gives: int(3) `var_dump( (int)3,88903098292 )` gives: int(3) --------------------------------- `var_dump( 0 )` gives: int(0) `var_dump( intval(0) )` gives: int(0) `var_dump( (int)0 )` gives: int(0) --------------------------------- `var_dump( 0 )` gives: string(1) "0" `var_dump( intval(0) )` gives: int(0) `var_dump( (int)0 )` gives: int(0) --------------------------------- `var_dump( )` gives: bool(false) `var_dump( intval() )` gives: int(0) `var_dump( (int) )` gives: int(0) --------------------------------- `var_dump( false )` gives: string(5) "false" `var_dump( intval(false) )` gives: int(0) `var_dump( (int)false )` gives: int(0) --------------------------------- `var_dump( 1 )` gives: bool(true) `var_dump( intval(1) )` gives: int(1) `var_dump( (int)1 )` gives: int(1) --------------------------------- `var_dump( )` gives: NULL `var_dump( intval() )` gives: int(0) `var_dump( (int) )` gives: int(0) --------------------------------- `var_dump( ? )` gives: string(1) "?" `var_dump( intval(?) )` gives: int(0) `var_dump( (int)? )` gives: int(0) --------------------------------- `var_dump( 1.000,31 )` gives: string(8) "1.000,31" `var_dump( intval(1.000,31) )` gives: int(1) `var_dump( (int)1.000,31 )` gives: int(1) --------------------------------- `var_dump( 1,000.31 )` gives: string(8) "1,000.31" `var_dump( intval(1,000.31) )` gives: int(1) `var_dump( (int)1,000.31 )` gives: int(1) --------------------------------- `var_dump( 1,000.31 )` gives: string(8) "1,000.31" `var_dump( intval(1,000.31) )` gives: int(1) `var_dump( (int)1,000.31 )` gives: int(1) --------------------------------- `var_dump( 1.000,31 USD )` gives: string(12) "1.000,31 USD" `var_dump( intval(1.000,31 USD) )` gives: int(1) `var_dump( (int)1.000,31 USD )` gives: int(1) ---------------------------------
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( 3 )` gives:PHP_EOLint(3) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(3) )` gives:PHP_EOLint(3) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)3 )` gives:PHP_EOLint(3) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( 3.4889211135 )` gives:PHP_EOLfloat(3.4889211135) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(3.4889211135) )` gives:PHP_EOLint(3) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)3.4889211135 )` gives:PHP_EOLint(3) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( 3 )` gives:PHP_EOLint(3) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(3) )` gives:PHP_EOLint(3) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)3 )` gives:PHP_EOLint(3) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( 88903098292 )` gives:PHP_EOLint(88903098292) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(88903098292) )` gives:PHP_EOLint(88903098292) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)88903098292 )` gives:PHP_EOLint(88903098292) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( 3 )` gives:PHP_EOLstring(1) "3" Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(3) )` gives:PHP_EOLint(3) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)3 )` gives:PHP_EOLint(3) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( 3.4889211135 )` gives:PHP_EOLstring(12) "3.4889211135" Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(3.4889211135) )` gives:PHP_EOLint(3) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)3.4889211135 )` gives:PHP_EOLint(3) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( 3,88903098292 )` gives:PHP_EOLstring(13) "3,88903098292" Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(3,88903098292) )` gives:PHP_EOLint(3) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)3,88903098292 )` gives:PHP_EOLint(3) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( 0 )` gives:PHP_EOLint(0) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(0) )` gives:PHP_EOLint(0) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)0 )` gives:PHP_EOLint(0) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( 0 )` gives:PHP_EOLstring(1) "0" Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(0) )` gives:PHP_EOLint(0) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)0 )` gives:PHP_EOLint(0) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( )` gives:PHP_EOLbool(false) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval() )` gives:PHP_EOLint(0) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int) )` gives:PHP_EOLint(0) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( false )` gives:PHP_EOLstring(5) "false" Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(false) )` gives:PHP_EOLint(0) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)false )` gives:PHP_EOLint(0) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( 1 )` gives:PHP_EOLbool(true) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(1) )` gives:PHP_EOLint(1) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)1 )` gives:PHP_EOLint(1) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( )` gives:PHP_EOLNULL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval() )` gives:PHP_EOLint(0) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int) )` gives:PHP_EOLint(0) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( ? )` gives:PHP_EOLstring(1) "?" Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(?) )` gives:PHP_EOLint(0) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)? )` gives:PHP_EOLint(0) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( 1.000,31 )` gives:PHP_EOLstring(8) "1.000,31" Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(1.000,31) )` gives:PHP_EOLint(1) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)1.000,31 )` gives:PHP_EOLint(1) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( 1,000.31 )` gives:PHP_EOLstring(8) "1,000.31" Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(1,000.31) )` gives:PHP_EOLint(1) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)1,000.31 )` gives:PHP_EOLint(1) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( 1,000.31 )` gives:PHP_EOLstring(8) "1,000.31" Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(1,000.31) )` gives:PHP_EOLint(1) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)1,000.31 )` gives:PHP_EOLint(1) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 23 `var_dump( 1.000,31 USD )` gives:PHP_EOLstring(12) "1.000,31 USD" Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 25 `var_dump( intval(1.000,31 USD) )` gives:PHP_EOLint(1) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 27 `var_dump( (int)1.000,31 USD )` gives:PHP_EOLint(1) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/83okL on line 29 ---------------------------------PHP_EOL