duanbei1598
2018-12-19 11:01
浏览 19
已采纳

find数组键是否等于特定数组中的值?

Hi All already i asked one question regarding array based key equal to value in array. Here my previous link please check enter link description here

If i follow the above link am not getting correct data. in_array finding all columns , but i want to find in room_no only one column in a array. If i use in_array(1,$singleArray) it will finding all columns in array,i need only key is room_no equal to 1.

Array
(
    [0] => Array
        (
            [pass_id] => 13087
            [AL_RefNo] => H181200000061
            [passenger_type] => adult
            [title] => Mr.
            [first_name] => R1 F1
            [middle_name] => 
            [last_name] => R1 LI
            [gender] => 
            [child_age] => 
            [room_no] => 1
            [zip_code] => 
            [state] => 
            [mobile] => 
            [email] => 
            [address] => 
            [country] => 
            [special_request] => 
            [HQRequest] => 
            [lead] => 1
            [modify_date] => 
            [srm_pax_id] => 15037
            [PAX_NAME] => 
            [CITY] => 
            [HOTEL_NAME] => 
            [COUNTRY_NAME] => 
            [LPO_NUMBER] => 
            [LPO_DATE] => 
            [LPO_AMOUNT] => 
            [LPO_AMOUNT_DIFFERENCE] => 
            [LINE_SEQUENCE] => 
            [PROJECT_ID] => 
            [TRAVEL_TYPE] => 
            [OTHER_ID] => 
            [REMARKS] => 
            [REMARKS1] => 
            [updated_on] => 2018-12-19 14:40:33
            [actual_hotel_confirmation_number] => 
            [is_delete] => 0
            [modify_refno] => H181200000061_1
        )

    [1] => Array
        (
            [pass_id] => 13088
            [AL_RefNo] => H181200000061
            [passenger_type] => adult
            [title] => Mr.
            [first_name] => R1 F2
            [middle_name] => 
            [last_name] => R1 L2
            [gender] => 
            [child_age] => 
            [room_no] => 1
            [zip_code] => 
            [state] => 
            [mobile] => 
            [email] => 
            [address] => 
            [country] => 
            [special_request] => 
            [HQRequest] => 
            [lead] => 0
            [modify_date] => 
            [srm_pax_id] => 15038
            [PAX_NAME] => 
            [CITY] => 
            [HOTEL_NAME] => 
            [COUNTRY_NAME] => 
            [LPO_NUMBER] => 
            [LPO_DATE] => 
            [LPO_AMOUNT] => 
            [LPO_AMOUNT_DIFFERENCE] => 
            [LINE_SEQUENCE] => 
            [PROJECT_ID] => 
            [TRAVEL_TYPE] => 
            [OTHER_ID] => 
            [REMARKS] => 
            [REMARKS1] => 
            [updated_on] => 2018-12-11 12:00:35
            [actual_hotel_confirmation_number] => 
            [is_delete] => 0
            [modify_refno] => H181200000061_1
        )

    [2] => Array
        (
            [pass_id] => 13089
            [AL_RefNo] => H181200000061
            [passenger_type] => adult
            [title] => Mr.
            [first_name] => R2 F1
            [middle_name] => 
            [last_name] => R2 L1
            [gender] => 
            [child_age] => 
            [room_no] => 2
            [zip_code] => 
            [state] => 1
            [mobile] => 
            [email] => 
            [address] => 
            [country] => 
            [special_request] => 
            [HQRequest] => 
            [lead] => 1
            [modify_date] => 
            [srm_pax_id] => 15039
            [PAX_NAME] => 
            [CITY] => 
            [HOTEL_NAME] => 
            [COUNTRY_NAME] => 
            [LPO_NUMBER] => 
            [LPO_DATE] => 
            [LPO_AMOUNT] => 
            [LPO_AMOUNT_DIFFERENCE] => 
            [LINE_SEQUENCE] => 
            [PROJECT_ID] => 
            [TRAVEL_TYPE] => 
            [OTHER_ID] => 
            [REMARKS] => 
            [REMARKS1] => 
            [updated_on] => 2018-12-11 12:00:35
            [actual_hotel_confirmation_number] => 
            [is_delete] => 0
            [modify_refno] => H181200000061_1
        )

    [3] => Array
        (
            [pass_id] => 13090
            [AL_RefNo] => H181200000061
            [passenger_type] => adult
            [title] => Ms.
            [first_name] => R2 F2
            [middle_name] => 
            [last_name] => R2 L2
            [gender] => 
            [child_age] => 
            [room_no] => 2
            [zip_code] => 
            [state] => 1
            [mobile] => 
            [email] => 
            [address] => 
            [country] => 
            [special_request] => 
            [HQRequest] => 
            [lead] => 1
            [modify_date] => 
            [srm_pax_id] => 15040
            [PAX_NAME] => 
            [CITY] => 
            [HOTEL_NAME] => 
            [COUNTRY_NAME] => 
            [LPO_NUMBER] => 
            [LPO_DATE] => 
            [LPO_AMOUNT] => 
            [LPO_AMOUNT_DIFFERENCE] => 
            [LINE_SEQUENCE] => 
            [PROJECT_ID] => 
            [TRAVEL_TYPE] => 
            [OTHER_ID] => 
            [REMARKS] => 
            [REMARKS1] => 
            [updated_on] => 2018-12-19 14:40:38
            [actual_hotel_confirmation_number] => 
            [is_delete] => 0
            [modify_refno] => H181200000061_1
        )

    [4] => Array
        (
            [pass_id] => 13091
            [AL_RefNo] => H181200000061
            [passenger_type] => child
            [title] => Miss.
            [first_name] => R2 C1
            [middle_name] => 
            [last_name] => R2 CL1
            [gender] => 
            [child_age] => 10
            [room_no] => 2
            [zip_code] => 
            [state] => 
            [mobile] => 
            [email] => 
            [address] => 
            [country] => 
            [special_request] => 
            [HQRequest] => 
            [lead] => 
            [modify_date] => 
            [srm_pax_id] => 15041
            [PAX_NAME] => 
            [CITY] => 
            [HOTEL_NAME] => 
            [COUNTRY_NAME] => 
            [LPO_NUMBER] => 
            [LPO_DATE] => 
            [LPO_AMOUNT] => 
            [LPO_AMOUNT_DIFFERENCE] => 
            [LINE_SEQUENCE] => 
            [PROJECT_ID] => 
            [TRAVEL_TYPE] => 
            [OTHER_ID] => 
            [REMARKS] => 
            [REMARKS1] => 
            [updated_on] => 2018-12-11 12:00:35
            [actual_hotel_confirmation_number] => 
            [is_delete] => 0
            [modify_refno] => H181200000061_1
        )

    [5] => Array
        (
            [pass_id] => 13092
            [AL_RefNo] => H181200000061
            [passenger_type] => adult
            [title] => Mr.
            [first_name] => R3 F1
            [middle_name] => 
            [last_name] => R3 L1
            [gender] => 
            [child_age] => 
            [room_no] => 3
            [zip_code] => 
            [state] => 
            [mobile] => 
            [email] => 
            [address] => 
            [country] => 
            [special_request] => 
            [HQRequest] => 
            [lead] => 1
            [modify_date] => 
            [srm_pax_id] => 15042
            [PAX_NAME] => 
            [CITY] => 
            [HOTEL_NAME] => 
            [COUNTRY_NAME] => 
            [LPO_NUMBER] => 
            [LPO_DATE] => 
            [LPO_AMOUNT] => 
            [LPO_AMOUNT_DIFFERENCE] => 
            [LINE_SEQUENCE] => 
            [PROJECT_ID] => 
            [TRAVEL_TYPE] => 
            [OTHER_ID] => 
            [REMARKS] => 
            [REMARKS1] => 
            [updated_on] => 2018-12-11 12:00:35
            [actual_hotel_confirmation_number] => 
            [is_delete] => 0
            [modify_refno] => H181200000061_1
        )

    [6] => Array
        (
            [pass_id] => 13093
            [AL_RefNo] => H181200000061
            [passenger_type] => adult
            [title] => Ms.
            [first_name] => R3 F2
            [middle_name] => 
            [last_name] => R3 L2
            [gender] => 
            [child_age] => 
            [room_no] => 3
            [zip_code] => 
            [state] => 
            [mobile] => 
            [email] => 
            [address] => 
            [country] => 
            [special_request] => 
            [HQRequest] => 
            [lead] => 1
            [modify_date] => 
            [srm_pax_id] => 15043
            [PAX_NAME] => 
            [CITY] => 
            [HOTEL_NAME] => 
            [COUNTRY_NAME] => 
            [LPO_NUMBER] => 
            [LPO_DATE] => 
            [LPO_AMOUNT] => 
            [LPO_AMOUNT_DIFFERENCE] => 
            [LINE_SEQUENCE] => 
            [PROJECT_ID] => 
            [TRAVEL_TYPE] => 
            [OTHER_ID] => 
            [REMARKS] => 
            [REMARKS1] => 
            [updated_on] => 2018-12-19 14:46:17
            [actual_hotel_confirmation_number] => 
            [is_delete] => 0
            [modify_refno] => H181200000061_1
        )

    [7] => Array
        (
            [pass_id] => 13094
            [AL_RefNo] => H181200000061
            [passenger_type] => adult
            [title] => Mr.
            [first_name] => R4 F1
            [middle_name] => 
            [last_name] => R4 L1
            [gender] => 
            [child_age] => 
            [room_no] => 4
            [zip_code] => 
            [state] => 
            [mobile] => 
            [email] => 
            [address] => 
            [country] => 
            [special_request] => 
            [HQRequest] => 
            [lead] => 1
            [modify_date] => 
            [srm_pax_id] => 15044
            [PAX_NAME] => 
            [CITY] => 
            [HOTEL_NAME] => 
            [COUNTRY_NAME] => 
            [LPO_NUMBER] => 
            [LPO_DATE] => 
            [LPO_AMOUNT] => 
            [LPO_AMOUNT_DIFFERENCE] => 
            [LINE_SEQUENCE] => 
            [PROJECT_ID] => 
            [TRAVEL_TYPE] => 
            [OTHER_ID] => 
            [REMARKS] => 
            [REMARKS1] => 
            [updated_on] => 2018-12-19 14:46:25
            [actual_hotel_confirmation_number] => 
            [is_delete] => 0
            [modify_refno] => H181200000061_1
        )

    [8] => Array
        (
            [pass_id] => 13095
            [AL_RefNo] => H181200000061
            [passenger_type] => adult
            [title] => Ms.
            [first_name] => R4 F2
            [middle_name] => 
            [last_name] => R4 L2
            [gender] => 
            [child_age] => 
            [room_no] => 4
            [zip_code] => 
            [state] => 
            [mobile] => 
            [email] => 
            [address] => 
            [country] => 
            [special_request] => 
            [HQRequest] => 
            [lead] => 0
            [modify_date] => 
            [srm_pax_id] => 15045
            [PAX_NAME] => 
            [CITY] => 
            [HOTEL_NAME] => 
            [COUNTRY_NAME] => 
            [LPO_NUMBER] => 
            [LPO_DATE] => 
            [LPO_AMOUNT] => 
            [LPO_AMOUNT_DIFFERENCE] => 
            [LINE_SEQUENCE] => 
            [PROJECT_ID] => 
            [TRAVEL_TYPE] => 
            [OTHER_ID] => 
            [REMARKS] => 
            [REMARKS1] => 
            [updated_on] => 2018-12-11 12:00:35
            [actual_hotel_confirmation_number] => 
            [is_delete] => 0
            [modify_refno] => H181200000061_1
        )

    [9] => Array
        (
            [pass_id] => 13096
            [AL_RefNo] => H181200000061
            [passenger_type] => adult
            [title] => Mr.
            [first_name] => R5 F1
            [middle_name] => 
            [last_name] => R5 L1
            [gender] => 
            [child_age] => 
            [room_no] => 5
            [zip_code] => 
            [state] => 
            [mobile] => 
            [email] => 
            [address] => 
            [country] => 
            [special_request] => 
            [HQRequest] => 
            [lead] => 1
            [modify_date] => 
            [srm_pax_id] => 15046
            [PAX_NAME] => 
            [CITY] => 
            [HOTEL_NAME] => 
            [COUNTRY_NAME] => 
            [LPO_NUMBER] => 
            [LPO_DATE] => 
            [LPO_AMOUNT] => 
            [LPO_AMOUNT_DIFFERENCE] => 
            [LINE_SEQUENCE] => 
            [PROJECT_ID] => 
            [TRAVEL_TYPE] => 
            [OTHER_ID] => 
            [REMARKS] => 
            [REMARKS1] => 
            [updated_on] => 2018-12-18 17:54:33
            [actual_hotel_confirmation_number] => 
            [is_delete] => 0
            [modify_refno] => H181200000061_1
        )

    [10] => Array
        (
            [pass_id] => 13097
            [AL_RefNo] => H181200000061
            [passenger_type] => adult
            [title] => Ms.
            [first_name] => R5 F2
            [middle_name] => 
            [last_name] => R5 L2
            [gender] => 
            [child_age] => 
            [room_no] => 5
            [zip_code] => 
            [state] => 
            [mobile] => 
            [email] => 
            [address] => 
            [country] => 
            [special_request] => 
            [HQRequest] => 
            [lead] => 0
            [modify_date] => 
            [srm_pax_id] => 15047
            [PAX_NAME] => 
            [CITY] => 
            [HOTEL_NAME] => 
            [COUNTRY_NAME] => 
            [LPO_NUMBER] => 
            [LPO_DATE] => 
            [LPO_AMOUNT] => 
            [LPO_AMOUNT_DIFFERENCE] => 
            [LINE_SEQUENCE] => 
            [PROJECT_ID] => 
            [TRAVEL_TYPE] => 
            [OTHER_ID] => 
            [REMARKS] => 
            [REMARKS1] => 
            [updated_on] => 2018-12-11 12:00:35
            [actual_hotel_confirmation_number] => 
            [is_delete] => 0
            [modify_refno] => H181200000061_1
        )

    [11] => Array
        (
            [pass_id] => 13098
            [AL_RefNo] => H181200000061
            [passenger_type] => child
            [title] => Master.
            [first_name] => R5 CF1
            [middle_name] => 
            [last_name] => R5 CL1
            [gender] => 
            [child_age] => 9
            [room_no] => 5
            [zip_code] => 
            [state] => 
            [mobile] => 
            [email] => 
            [address] => 
            [country] => 
            [special_request] => 
            [HQRequest] => 
            [lead] => 
            [modify_date] => 
            [srm_pax_id] => 15048
            [PAX_NAME] => 
            [CITY] => 
            [HOTEL_NAME] => 
            [COUNTRY_NAME] => 
            [LPO_NUMBER] => 
            [LPO_DATE] => 
            [LPO_AMOUNT] => 
            [LPO_AMOUNT_DIFFERENCE] => 
            [LINE_SEQUENCE] => 
            [PROJECT_ID] => 
            [TRAVEL_TYPE] => 
            [OTHER_ID] => 
            [REMARKS] => 
            [REMARKS1] => 
            [updated_on] => 2018-12-11 12:00:35
            [actual_hotel_confirmation_number] => 
            [is_delete] => 0
            [modify_refno] => H181200000061_1
        )

)

If you see above output in array [room_no] found 2 times in that array[0], array1. if i use in_array(1,$myArrayOutPut){ } it will taking array[3],array[4] state key also 1 .so taking this all arrays where key is 1. But i need room_no is 1

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题