3v4l.org

run code in 300+ PHP versions simultaneously
<?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.3.11, 4.4.0 - 4.4.9, 5.0.2 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
`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

preferences:
245.94 ms | 422 KiB | 399 Q