Script functions reference > Script functions in alphabetical order > F > FindStringExactInArray

FindStringExactInArray
Syntax
FindStringExactInArray(array_name, str);
array_name
str
Description
Searches for a value in an array. Returns the position of the array element that contains exactly the specified value.
Returns
num
-1
Example
This example has two arrays:
$arrTele containing phone numbers.
$arrAmount containing call charges.
The FindStringExactInArray function is used to search for the phone number in $arrTele.
If a phone number for a specific call is found in $arrTele, the charge for the call should be added to the corresponding position in $arrAmount.
If the phone number is not found, the new phone number should be added to $arrTele and the new charge to $arrAmount. The ArraySize function specifies the position where to add the new number and charge at the end of the arrays.
$retIndex=FindStringExactInArray($arrTele, $noDialled);
if ($retIndex="-1")
   {
      $retSize=ArraySize($arrTele);
      $arrTele[$retSize]=$noDialled;
      $arrAmount[$retSize]=$callCharge;
   }
else
    $arrAmount[$retIndex]=$callCharge;
OpenText StreamServe 5.6 Updated: 2013-03-01