3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('memory_limit', '-1'); // http://forrk.co.uk/blog/Finding-a-short-Twitter-Username-Mission-Impossible/1 function checkusername($username){ if(!empty($username) && $username != ''){ $url="http://twitter.com/".$username; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec($ch); $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if($http_status == '404'){ echo 'Available: '.$username."\n"; } else{ // not available } }// if }// function checkusername($username) // http://stackoverflow.com/a/19067884/901502 function build_usernames($chars, $size, $combinations = array()){ // if it's the first iteration, the first set // of combinations is the same as the set of characters if(empty($combinations)){ $combinations = $chars; } // we're done if we're at size 1 if ($size == 1) { return $combinations; } // initialise array to put new values in $new_combinations = array(); // loop through existing combinations and character set to create strings foreach($combinations as $combination){ foreach($chars as $char){ $new_combinations[] = $combination . $char; }// foreach }// foreach // call same function again for the next iteration return build_usernames($chars, $size - 1, $new_combinations); }// function build_usernames($chars, $size, $combinations = array()) // set the possible chars to build the username from $possible_chars = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm'); // build the user name combinations for up to 4 char usernames $possible_usernames = build_usernames($possible_chars, 4); // loop through all usernames and check each with twitter foreach($possible_usernames as $username){ checkusername($username); }
Output for git.master, rfc.property-hooks
Fatal error: Out of memory (allocated 29364224 bytes) (tried to allocate 16777224 bytes) in /in/khDe6 on line 48 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for git.master_jit
Fatal error: Out of memory (allocated 16781312 bytes) (tried to allocate 8388616 bytes) in /in/khDe6 on line 48 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
50.43 ms | 401 KiB | 8 Q