开发者

implode the array by AND in between

开发者 https://www.devze.com 2023-03-10 16:33 出处:网络
I have this $myarr = Array( 0 => \"Person.id = PL.id AND AIG.id = PL.key,\" 1 => \"start_date BETWEEN\'$startDate\' AND\'$endDate\'\",

I have this

$myarr = Array(
    0 => "Person.id = PL.id AND AIG.id = PL.key,"
    1 => "start_date BETWEEN  '$startDate' AND  '$endDate'",
    2 => "J = 78349",   
    3 => "text is not null;"
)

I want to implode this array with an AND like

implode("AND", $myarr) 

But it doesnt but AND between the 4 elements of array. How would I put an AND between these 4 elements of the 开发者_StackOverflow社区array.


$string = implode(" AND ",$myarr);

that should work fine. It will write the output to $string.

0

精彩评论

暂无评论...
验证码 换一张
取 消