|
Posted by brendan on 09/07/05 15:35
"Erwin Moller"
<since_humans_read_this_I_am_spammed_too_much@spamyourself.com> wrote in
message news:431edcae$0$11079$e4fe514c@news.xs4all.nl...
> > We want to allow the user to specify database columns by using
> >
> > [column name][colon][search text]
> >
> > i.e.
> > "author:Jane Smith institution:university of Cambridge year:1976"
> Who needs regexp? :P
>
> Try something like this:
>
> <?
> // [column name][colon][search text]
>
> $test = "author:Jane Smith institution:university of Cambridge year:1976";
> $result = array();
>
> $parts = explode(":",$test);
> for($i=0;$i<count($parts);$i+=2){
> $result[$parts[$i]] = $parts[$i+1];
>
> Regards,
> Erwin Moller
>
> PS: Does your reward also include the ticket to Cambridge from Holland?
;-)
Hi Erwin,
Exploding on the colon will result in the column name ending up in the
previous array set
ie
arrayname["author"]= "Jane Smith institution";
arrayname["university of Cambridge year"1976";
....
which is unfortunately not what I am looking for ... I need it to split at
the begining of any word ending in a colon, not at the colon point.
Unfortunately the offer doesn't include the ticket. However, I'm sure I
could organise delivery next time I am up your way ;)
b.
Navigation:
[Reply to this message]
|