senters Posted March 29, 2013 Report Share Posted March 29, 2013 (edited) Kā (un kāds būtu labākais veids) no masīva string elementa izkasīt ārā itemid ciparu? Array ( [currency] => LVL [shipping] => 0 [tax] => 0 [taxRate] => 0 [itemCount] => 3 [item_name_1] => Preces nosaukums x [item_quantity_1] => 1 [item_price_1] => 10 [item_options_1] => itemno: 14, itemid: 53, image: img/catalog/xxx/ico/14.jpg, key: 000014 [item_name_2] => Preces nosaukums y [item_quantity_2] => 1 [item_price_2] => 10 [item_options_2] => itemno: 15, itemid: 54, image: img/catalog/xxx/ico/15.jpg, key: 000015 [item_name_3] => Preces nosaukums z [item_quantity_3] => 1 [item_price_3] => 5 [item_options_3] => itemno: 2, itemid: 91, image: img/catalog/xxx/ico/2.jpg, key: A00002 ) Edited March 29, 2013 by senters Link to comment Share on other sites More sharing options...
waplet Posted March 29, 2013 Report Share Posted March 29, 2013 (edited) $string = "itemno: 15, itemid: 541, image: img/catalog/xxx/ico/15.jpg, key: 000015"; preg_match_all("/itemid: ([0-9]+),/",$string,$matches); print_r($matches[2]); Edited March 29, 2013 by waplet Link to comment Share on other sites More sharing options...
senters Posted April 1, 2013 Author Report Share Posted April 1, 2013 Paldies, šeit nedaudz pamainīju simplecartjs.org groza .js, padodot POST masīvā atsevišķi itema id. Link to comment Share on other sites More sharing options...
Recommended Posts