Re: 2 questions: Search in array and detect JS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



don't know if someone mentioned it already but i was digging around in the docs
for something completely different and bumped into this:

preg_grep() [http://php.net/preg_grep]

and I thought of your question, might be just what your looking for.

I can't remember having come across this func before - learn something new every day :-)


Ryan A wrote:
Hi,
Like the subject says; I have two questions:

1) Is it possible to detect JavaScript via php... and yes I do know that JS
is client side while PHP is server...but how else to do it?
The reason I ask is before serving an AJAX page I would like to make sure JS
is enabled, if not, serve the other "normal page"... I am sure I am not the
first person to come accross this little problem, how did you solve it?

I have seen some suggestions on google like having a hidden form field  and
using  js to put a value in it, if it exists when the form is sent then JS
is on..if not, its not... but that method is not the best in an AJAX
situation...right?


2) How can I search in an array for a particular word?

eg: in an array "movie" I have this kind of data:
movie_name=> some movie
cast=> Jim Carrey, Richard Pryor, Eddie Murphy

I want to search on either "Richard" or "Richard Pryor" (must be case
insensitive too)
something like a SELECT with a LIKE %% statement

I have been fooling around with in_array() but not getting anywhere
fast..... am I on the right track?
Links, code examples or advise would be as always....appreciated.

Thanks,
Ryan


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux