mirror of
https://github.com/php/doc-pl.git
synced 2026-03-25 23:52:07 +01:00
Well, it doesn't really make the Polish manual much better but it does reduce the amount of outdated files substantially leaving the ones that deserve some actual work and thought.
157 lines
3.8 KiB
XML
157 lines
3.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 09003ff79e20ff948b2c9efb2745f7625637d7e4 Maintainer: sobak Status: ready -->
|
|
<!-- $Revision$ -->
|
|
|
|
<refentry xml:id="arrayaccess.offsetexists" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>ArrayAccess::offsetExists</refname>
|
|
<refpurpose>Sprawdza czy offset istnieje</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis role="ArrayAccess">
|
|
<modifier>public</modifier> <type>bool</type><methodname>ArrayAccess::offsetExists</methodname>
|
|
<methodparam><type>mixed</type><parameter>offset</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Sprawdza czy offset istnieje.
|
|
</para>
|
|
<para>
|
|
Ta metoda jest wykonywana gdy użyto <function>isset</function> lub
|
|
<function>empty</function> na obiektach implementujących <classname>ArrayAccess</classname>.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Przy użyciu <function>empty</function> <function>ArrayAccess::offsetGet</function> zostanie
|
|
wywołane i sprawdzone czy jest puste, tylko jeśli <function>ArrayAccess::offsetExists</function>
|
|
zwróci &true;.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry><term><parameter>offset</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Offset do sprawdzenia.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Zwracana wartość zostanie skonwertowana do typu <type>bool</type>, jeżeli została zwrócona inna niż wartość logiczna.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Przykład użycia <function>ArrayAccess::offsetExists</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
class obj implements ArrayAccess {
|
|
public function offsetSet($offset, $value): void {
|
|
var_dump(__METHOD__);
|
|
}
|
|
public function offsetExists($var): bool {
|
|
var_dump(__METHOD__);
|
|
if ($var == "foobar") {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public function offsetUnset($var): void {
|
|
var_dump(__METHOD__);
|
|
}
|
|
#[\ReturnTypeWillChange]
|
|
public function offsetGet($var) {
|
|
var_dump(__METHOD__);
|
|
return "wartość";
|
|
}
|
|
}
|
|
|
|
$obj = new obj;
|
|
|
|
echo "Wykonuje obj::offsetExists()\n";
|
|
var_dump(isset($obj["foobar"]));
|
|
|
|
echo "\nWykonuje obj::offsetExists() i obj::offsetGet()\n";
|
|
var_dump(empty($obj["foobar"]));
|
|
|
|
echo "\nWykonuje obj::offsetExists(), *nie* obj:offsetGet(), gdyż nie ma nic do pobrania\n";
|
|
var_dump(empty($obj["foobaz"]));
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
Wykonuje obj::offsetExists()
|
|
string(17) "obj::offsetExists"
|
|
bool(true)
|
|
|
|
Wykonuje obj::offsetExists() and obj::offsetGet()
|
|
string(17) "obj::offsetExists"
|
|
string(14) "obj::offsetGet"
|
|
bool(false)
|
|
|
|
Wykonuje obj::offsetExists(), *nie* obj:offsetGet(), gdyż nie ma nic do pobrania
|
|
string(17) "obj::offsetExists"
|
|
bool(true)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
|
|
<!--
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><methodname>Classname::Method</methodname></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
-->
|
|
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|