Say
$array _a={1,1,1,2,2,2,3,3,3,4,4,4,5,5,5}
$array _b={a,a,a,a,a,b,b,b,b,c,c,c,s,s,s}
$array _c={b,b,c,d,d,s,a,s,d,s,a,d,a,d,d}
Think of it as a database, 3 fields and content.
I want to use the PHP array function to implement the database where query for example is where $array _a=1 content is AAA and BBC
How do I write in PHP? I can't use this method because the environment has too many limits.
Reply to discussion (solution)
This is not the right description, if equal to 2, the time equals 3 o'clock?
Did not think of any good way, can only according to the value of a to check the respective position of the corresponding elements, and then use these locations to B,c to take the value
Why not:
$ABC = Array (Array (1, ' A ', ' B '), Array (1, ' A ', ' B '),)
or save it as a file emulation database. Then customize the search function
$array _a = Explode (', ', ' 1,1,1,2,2,2,3,3,3,4,4,4,5,5,5 '); $array _b = Explode (', ', ' a,a,a,a,a,b,b,b,b,c,c,c,s,s,s '); $ Array_c = Explode (', ', ' b,b,c,d,d,s,a,s,d,s,a,d,a,d,d '); $res _a = Array_keys ($array _a, 1); $res _b = Array_intersect_key ( $array _b, Array_flip ($res _a)), $res _c = Array_intersect_key ($array _c, Array_flip ($res _a));p Rint_r ($res _b);p Rint_r ($ Res_c);
Array
(
[0] = a
[1] = a
[2] = a
)
Array
(
[0] = b
[1] = b
[2] = C
)
$array _a = Explode (', ', ' 1,1,1,2,2,2,3,3,3,4,4,4,5,5,5 '); $array _b = Explode (', ', ' a,a,a,a,a,b,b,b,b,c,c,c,s,s,s '); $ Array_c = Explode (', ', ' b,b,c,d,d,s,a,s,d,s,a,d,a,d,d '); $res _a = Array_keys ($array _a, 1); $res _b = Array_intersect_key ( $array _b, Array_flip ($res _a)), $res _c = Array_intersect_key ($array _c, Array_flip ($res _a));p Rint_r ($res _b);p Rint_r ($ Res_c);
Array
(
[0] = a
[1] = a
[2] = a
)
Array
(
[0] = b
[1] = b
[2] = C
)
Using Array_intersect_key to search for good Array_flip ($res _a) is this feeling superfluous?