Jump to content

Archived

This topic is now archived and is closed to further replies.

feri_soft

Search in arrays?

Recommended Posts

I have the following problem i have 5 checkboxes with the name asd[]
when someone is adding an article he is cheking for example 3 checkboxes with values 2,4,5

Then i have a search page.A user selects the chekboxes but in that order:

5,2,4

Will php create the same array with the values 2,4,5 ordering them in alph. order or it will create an array like 5,2,4.And if the second how can i make a search,because the values are the same but as they are stored in the row like 2,4,5 and i search for 5,2,4 i wont get anything.

Please help :)

Share this post


Link to post
Share on other sites
I dont know, but you can just use the function [url=http://www.php.net/manual/en/function.sort.php]sort()[/url] on both arrays before comparing :)

Orio.

Share this post


Link to post
Share on other sites
example:
[code]
<?php

$asd = array(9,15,5,3,7,1);
sort($asd);
reset($asd);
$new_asd = implode($asd,",");
echo $new_asd; // 1,3,5,7,9,15

?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.