Voting

: three plus five?
(Example: nine)

The Note You're Voting On

n-regen
15 years ago
If you only know a part of a value in an array and want to know the complete value, you can use the following function:
<?php
function array_find($needle, $haystack)
{
foreach (
$haystack as $item)
{
if (
strpos($item, $needle) !== FALSE)
{
return
$item;
break;
}
}
}
?>
The function returns the complete first value of $haystack that contains $needle.

<< Back to user notes page

To Top