Hey everyone,
Hoping this is easy and it is just me overlooking something simple.
I have a GET api query which is running perfectly, however, I am trying to write a PHP IF statement for if the array is empty, like this:
The concept, I am integrating my PBX system and have the values passing to my script. I want to search the Contacts phone numbers, and if the number is found, assign a value, if the number is not found I want it to run the same api get on the leads database.
So in short.
Phone number = 12345
Get from contacts, ID where phone number = 12345 (if record found, set ContactID = ContactID)
IF no contacts found get from Leads, ID where phone number = 12345 (if record found, set LeadID = LeadID)
ELSE nothing.
I can get it to work pefectly if the phone number is in the contact's by using the array $contactId = $response['list'][0]['id'], but don't know how to move it through the if statement when the 'total' in the array is 0.
Any thoughts? Thanking you all muchly in advance.
Hoping this is easy and it is just me overlooking something simple.
I have a GET api query which is running perfectly, however, I am trying to write a PHP IF statement for if the array is empty, like this:
Code:
Array ( [total] => 0[list] => Array ( ) )
So in short.
Phone number = 12345
Get from contacts, ID where phone number = 12345 (if record found, set ContactID = ContactID)
IF no contacts found get from Leads, ID where phone number = 12345 (if record found, set LeadID = LeadID)
ELSE nothing.
I can get it to work pefectly if the phone number is in the contact's by using the array $contactId = $response['list'][0]['id'], but don't know how to move it through the if statement when the 'total' in the array is 0.
Any thoughts? Thanking you all muchly in advance.
Comment