3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "code": "200002 - VALUE_TOO_LONG", "title": "Der von Ihnen gepflegte Wert ist zu lang. K\u00fcrzen Sie die den Wert entsprechend der Zeichenbegrenzung aus der API-Dokumentation.", "path": "\/products", "jsonPath": "$.productVariations[?(@.sku==\"506163\")].productDescription.bulletPoints" }'; $decode = json_decode($json, true); $re = '/\$.productVariations\[.*sku=="(.*)".*].(.*)/m'; preg_match($re, $decode['jsonPath'], $matches); if (!empty($matches)) { $sku = $matches[1]; $field = $matches[2]; } else { $re = '/\$.productVariations\[.*].(.*)/m'; preg_match($re, $decode['jsonPath'], $matches); $sku = '?'; $field = $matches[1]; } var_dump($sku); var_dump($field);
Output for git.master, git.master_jit, rfc.property-hooks
string(6) "506163" string(31) "productDescription.bulletPoints"

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:
48.53 ms | 401 KiB | 8 Q