3v4l.org

run code in 300+ PHP versions simultaneously
<?php $Code ='Q) A. We were watching television last night. B. We was watching television last night. A) a) A b) B Q) Four words are given below out of which three words have similar meaning. Find the odd word which has a different meaning. E.g.: A) a) speak b) discuss c) converse d) comprehend '; function explodeX($delimiters,$string) { $return_array = Array($string); // The array to return $d_count = 0; while (isset($delimiters[$d_count])) // Loop to loop through all delimiters { $new_return_array = Array(); foreach($return_array as $el_to_split) // Explode all returned elements by the next delimiter { $put_in_new_return_array = explode($delimiters[$d_count],$el_to_split); foreach($put_in_new_return_array as $substr) // Put all the exploded elements in array to return { $new_return_array[] = $substr; } } $return_array = $new_return_array; // Replace the previous return array by the next version $d_count++; } return $return_array; // Return the exploded elements } $output = explodeX(Array("Q)","A)"), $Code); //Calling the function using the split parameters echo $output[1]; //echo $output[2]; $your_array = explode(") ", $output[2]); echo $your_array[0]; echo $your_array[1]; ?>
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.33, 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.4, 8.3.6
A. We were watching television last night. B. We was watching television last night. aA b
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 A. We were watching television last night. B. We was watching television last night. aA b

preferences:
250.06 ms | 402 KiB | 322 Q