note 57799 added to function.array-keys

From: Date: Fri, 14 Oct 2005 13:38:17 +0000
Subject: note 57799 added to function.array-keys
Groups: php.notes 
Request: Send a blank email to php-notes+get-97018@lists.php.net to get a copy of this message
hello people this is my first time here, i am 18 years... i am so exited!!! i am from Paraguay.. and i wrote this funcion, if someone knows if php brings a compiled funcion similar to this please write to me... (sorry 4 my english i am learning it) this is a funcion which search in array <? function search_array($array,$word) { /* Made in Paraguay!!! Please visit my website www.saddor.com thank u!!! */ $i=array(); if (!is_array($array)) return false; foreach ($array as $key=>$value) { if (stristr($value,$word)) { $i[]=$key; } } /* I am a C/C++ programmer and i dont know if is right what i am doing belong this comment, what i am trying to do is free memory.. please write me if it will do my code more faster */ unset($array); unset($key); unset($value); return $i; } /* Some example */ $a[2]="cesar rodas"; $a[4]="saddor"; $a[6]="rodas cesar"; $a[15]="saddor.com rodas saddor.com"; print_r (search_array($a,"rodas")); print "<br>"; exit; ?> This script will output something sililar to this: Array ( [0] => 2 [1] => 6 [2] => 15 ) whatever thing write tome to saddor@gmail.com ---- Manual Page -- http://www.php.net/manual/en/function.array-keys.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57799 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57799&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57799&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57799&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57799&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57799&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57799&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57799&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57799&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97018) next »