Split a string with two delimiters into two arrays (explode twice)

You can explode the string by commas, and then explode each of those values by x, inserting the result values from that into the two arrays: $str = “20×9999,24×65,40×5”; $array1 = array(); $array2 = array(); foreach (explode(‘,’, $str) as $key => $xy) { list($array1[$key], $array2[$key]) = explode(‘x’, $xy); } Alternatively, you can use preg_match_all, matching … Read more

Hive Explode / Lateral View multiple arrays

I found a very good solution to this problem without using any UDF, posexplode is a very good solution : SELECT COOKIE , ePRODUCT_ID, eCAT_ID, eQTY FROM TABLE LATERAL VIEW posexplode(PRODUCT_ID) ePRODUCT_IDAS seqp, ePRODUCT_ID LATERAL VIEW posexplode(CAT_ID) eCAT_ID AS seqc, eCAT_ID LATERAL VIEW posexplode(QTY) eQTY AS seqq, eDateReported WHERE seqp = seqc AND seqc = … Read more

PHP: Split string into array, like explode with no delimiter

$array = str_split(“0123456789bcdfghjkmnpqrstvwxyz”); str_split takes an optional 2nd param, the chunk length (default 1), so you can do things like: $array = str_split(“aabbccdd”, 2); // $array[0] = aa // $array[1] = bb // $array[2] = cc etc … You can also get at parts of your string by treating it as an array: $string = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)