php - json_encode add a line between two array -


i working array , json_encode, having 2 array example .

array1: -------     [0] => hotels     [1] => hotels-hotels - apartments     [2] => hotels - ibis     [3] => hotels - hotel     [4] => hotels - muscat     [5] => hotels - stay     [6] => --------------------------- array2:     [7] => first     [8] => second     [9] => third echo json_encode($result, true);exit 

the result is

{"status":true,"response":["---------------------------","first","second","third"]}

but need join previous array value also, , "----------"(line) should not selectable.


merge array before encoding them :

json_encode(array_merge($array_1, $array2)); 

do clean operations on arrays:

function array_cleanup($array) {     // remove undesired cells...     return $array; } 

you have error using json_encode() function: second parameter must unsigned integer , not boolean, please read official documentation of json_encode: http://php.net/manual/en/function.json-encode.php


Comments

Popular posts from this blog

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -