Skip to content

Instantly share code, notes, and snippets.

@sonichandni
Last active September 23, 2021 13:36
Show Gist options
  • Save sonichandni/39ce2d68c99e36e9fc0ce9fabecf932f to your computer and use it in GitHub Desktop.
Save sonichandni/39ce2d68c99e36e9fc0ce9fabecf932f to your computer and use it in GitHub Desktop.
array search
<!-- Array
(
[0] => Array
(
[form_id] => 224
)
[1] => Array
(
[form_id] => 237
)
) -->
$array = 'above array';
$data = array_column($data, 'form_id'); //array of ID
$result = array_search( 237, $data );
echo $result // 1 - it means 237 exist in array
$result = array_search( 2373, $data );
echo $result // it will not reyurn anything, which means data not exist
@sonichandni
Copy link
Author

initial commit

@sonichandni
Copy link
Author

change code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment