3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $testing_string = "OFFER_TYPE_1"; var_dump(strpos($field, 'OFFER_URL_ENG')); $array = explode("_", $testing_string); var_dump($array); $index = intval(end($array))-1; //array index start from 0, while for user readability index starts at 1 unset($array[key($array)]); echo implode("_", $array);
based on iqffD
Output for 5.6.0 - 5.6.30, hhvm-3.21.3, 7.0.0 - 7.3.0beta1
Notice: Undefined variable: field in /in/XnOEc on line 4 bool(false) array(3) { [0]=> string(5) "OFFER" [1]=> string(4) "TYPE" [2]=> string(1) "1" } OFFER_TYPE
Output for hhvm-3.22.0
Notice: Undefined variable: field in /in/XnOEc on line -1 bool(false) array(3) { [0]=> string(5) "OFFER" [1]=> string(4) "TYPE" [2]=> string(1) "1" } OFFER_TYPE
Output for hhvm-3.18.5
Notice: Undefined variable: field in /in/XnOEc on line 4 Warning: strpos() expects parameter 1 to be string, null given in /in/XnOEc on line 4 NULL array(3) { [0]=> string(5) "OFFER" [1]=> string(4) "TYPE" [2]=> string(1) "1" } OFFER_TYPE