I can’t figure out why the following doesn’t work. Basically, I have two channels which contain member data as a VZ Member fields in Matrix cells or CKI Member List fields. The idea is to create an array of those member ids, compare it to the currently logged in user and, if there is a match, display data. The code is in an embedded template, the PHP is producing an array, everything checks out- but when I check the results by using in_array or in a foreach loop it never returns true.
Thanks for looking!
the currently logged in member, echoing this variable returns the correct value, the variable type is a string. Casting it as an integer returns 0 every time.
$member = "{logged_in_member_id}";the array: when I print this array the values are correct. For what it’s worth, gettype shows all the values are strings, not integers.
ex., Array ( [0] => 7 [1] => 54 [2] => 241 [3] => 1 [4] => 140 [5] => 35 [6] => 27 [7] => 215 [8] => 10 [9] => 239 [10] => 164 [11] => 224 [12] => 14 [13] => 157 [14] => 94 [15] => 239 [16] => 53 [17] => 83 [18] => 140 [19] => 190 [20] => 104 [21] => 164 [22] => 88 [23] => 121 [24] => 141 [25] => 26 [26] => 7 [27] => 137 [28] => 93 [29] => 10 [30] => 1 [31] => 218 [32] => 111 [33] => 91 [34] => 54 [35] => 5 )
$execcomm = array(
{exp:channel:entries channel="committee-membership_ch"}
{com-chairs}
'{com-chairs_name}',
{/com-chairs}
{/exp:channel:entries}
{exp:channel:entries channel="executive-committee_ch"}
{board}
'{board_members}',
{/board}
'{president get="member_id"}','{vice-president get="member_id"}','{treasurer get="member_id"}','{rec-secretary get="member_id"}','{cor-secretary get="member_id"}','{past-president get="member_id"}',
{/exp:channel:entries}
);so either of these should work, there are definitely matches in the array, but it absolutely doesn’t. Is this a parse order problem? Is my php bad?
foreach($execcomm as $value) {
if($value == $member) { echo "match"; }
}
if(in_array($member, $execcomm)) { echo "match"; }