3v4l.org

run code in 300+ PHP versions simultaneously
<?php function randomAlphaNum($length){ $alphNums = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; $newString = str_shuffle(str_repeat($alphNums, rand(1, $length))); return substr($newString, rand(0,strlen($newString)-$length), $length); } $domain = 'drmouse.com.ar'; $opt = array( CURLOPT_HEADER => 0, CURLOPT_URL => 'http://namey.muffinlabs.com/name.json?count=10&frequency=all&with_surname=true', CURLOPT_RETURNTRANSFER => 1 ); $ch = curl_init(); curl_setopt_array($ch, $opt); $results = curl_exec($ch); curl_close($ch); $results = json_decode($results); foreach ($results as $i => $name) { $fullname = explode(' ', $name); $names['doc'][] = strtolower("{$fullname[0]}{$fullname[1]}") . "@{$domain}"; $names['1pa'][] = "{$names['doc'][$i]} " . randomAlphaNum(18); $names['csv'][] = str_replace(' ', ",{$fullname[0]},{$fullname[1]},", $names['1pa'][$i]); } foreach (array('csv', '1pa', 'doc') as $place) { echo "<p><strong>{$place}:</strong></p>\n<ul>"; foreach ($names[$place] as $name) { echo "<li>{$name}</li>\n"; } echo '</ul>'; }
Output for 7.2.0 - 7.2.28, 7.3.0 - 7.3.15, 7.4.0 - 7.4.3
Warning: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' (this will throw an Error in a future version of PHP) in /in/E22an on line 10 Warning: Use of undefined constant CURLOPT_URL - assumed 'CURLOPT_URL' (this will throw an Error in a future version of PHP) in /in/E22an on line 11 Warning: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' (this will throw an Error in a future version of PHP) in /in/E22an on line 12 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/E22an:14 Stack trace: #0 {main} thrown in /in/E22an on line 14
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
Notice: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' in /in/E22an on line 10 Notice: Use of undefined constant CURLOPT_URL - assumed 'CURLOPT_URL' in /in/E22an on line 11 Notice: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /in/E22an on line 12 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/E22an:14 Stack trace: #0 {main} thrown in /in/E22an on line 14
Process exited with code 255.
Output for 5.0.0 - 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.40
Notice: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' in /in/E22an on line 10 Notice: Use of undefined constant CURLOPT_URL - assumed 'CURLOPT_URL' in /in/E22an on line 11 Notice: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /in/E22an on line 12 Fatal error: Call to undefined function curl_init() in /in/E22an on line 14
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Notice: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' in /in/E22an on line 10 Notice: Use of undefined constant CURLOPT_URL - assumed 'CURLOPT_URL' in /in/E22an on line 11 Notice: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /in/E22an on line 12 Fatal error: Call to undefined function: curl_init() in /in/E22an on line 14
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Notice: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' in /in/E22an on line 10 Notice: Use of undefined constant CURLOPT_URL - assumed 'CURLOPT_URL' in /in/E22an on line 11 Notice: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /in/E22an on line 12 Fatal error: Call to undefined function: curl_init() in /in/E22an on line 14
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' in /in/E22an on line 10 Notice: Use of undefined constant CURLOPT_URL - assumed 'CURLOPT_URL' in /in/E22an on line 11 Notice: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /in/E22an on line 12 Fatal error: Call to undefined function: curl_init() in /in/E22an on line 14

preferences:
234.81 ms | 402 KiB | 331 Q