You are here: Re: Something like "WHERE" from SQL « PHP SQL « IT news, forums, messages
Re: Something like "WHERE" from SQL

Posted by Rik on 11/27/06 16:47

Kenoli wrote:
> Is there a way to accomplish something like the "WHERE" syntax from
> SQL in php? For example an equivalent to the following, which I know
> is not proper php syntax.
>
> foreach ($var as $key => $value WHERE $key != '3') {
> echo "$key is $value";
> }
>
> or
>
> implode (",", $_POST WHERE $_POST[name] != 'post');
>
> I keep wanting to be able to do things like this.


array_filter();
http://nl3.php.net/manual/en/function.array-filter.php

The problem here is you cannot filter on keys.

On could use array_keys(), array_filter() and then again array_flip() and
array_intersect_keys(). It's hardly better then a foreach loop however, and
a lot less readable.
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация