🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.php
3 messages
3 total messages Started by Marcin Fri, 24 Aug 2001 07:48
klucz tablicy
#838
Author: Marcin
Date: Fri, 24 Aug 2001 07:48
19 lines
1270 bytes
witam

mam tablice "skrotow" w stylu
$table=array("jeden"=>"j","dwa"=>"d","trzy"=>"t");
zarowno klucze jak i wartosci sa unikalne
i teraz - chcac uzyskac klucz na podstawie wartosci robie
cos takiego:
<?
$szukany="d";
foraech($table as $key=>$value)
    if($szukany==$value)
        print($key);
?>

czy da sie to zrobic jakos bez petli "przeszukiwania"?

pozdrawiam

Marcin
Re: klucz tablicy
#839
Author: Tomasz Nidecki
Date: Fri, 24 Aug 2001 08:24
12 lines
1757 bytes
In article <9m51i8$pkg$1@news.tpi.pl>, "Marcin" <marcin@sdi.pl> wrote:

> czy da sie to zrobic jakos bez petli "przeszukiwania"?

rzuc okiem na funkcje "key" - AFAIR ona to umozliwia (ale moge teraz nie 
pamietac dokladnie ;)

-- 
tomasz 'tonid' nidecki, zoliborz, warszawa, poland
mailto:tonid@tonid.net http://endemic.tonid.net
http://elektron.tonid.net - wazne ostrzezenie przed firma Elektron!!!
PGP: 11E3 2772 7E95 8962 F932  7FAA 72F2 4CCC 1C70 DB83
Re: klucz tablicy
#840
Author: slawek-
Date: Fri, 24 Aug 2001 10:06
8 lines
947 bytes
"Marcin" <marcin@sdi.pl> napisał:
> czy da sie to zrobic jakos bez petli "przeszukiwania"?

Znalazłem to w minutę:

http://www.php.net/manual/en/function.array-search.php

slawek-
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads