Re: ARRAY and SEARCH Button
Posted: Thu Aug 06, 2009 9:39 am
i was able to display the records already im now working on searching and im getting hard time on it argh 
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
$array = array(
'this is about football',
'this is about basketball',
'this is about....something else',
'blah',
'foo'
);
$search = 'basketball';
foreach($array as $key => $value)
if(!stristr($value, $search))
unset($array[$key]);
print_r($array);jackpf wrote:I gave you the code!!! How can you "get a hard time"!?!??!![]()
Look:That is the exact code - I've handed it to you on a plate.Code: Select all
<?php $array = array( 'this is about football', 'this is about basketball', 'this is about....something else', 'blah', 'foo' ); $search = 'basketball'; foreach($array as $key => $value) if(!stristr($value, $search)) unset($array[$key]); print_r($array);