mirror of
https://github.com/php/doc-tr.git
synced 2026-03-23 23:02:09 +01:00
143 lines
3.5 KiB
XML
143 lines
3.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- EN-Revision: 4d17b7b4947e7819ff5036715dd706be87ae4def Maintainer: nilgun Status: ready -->
|
||
<reference xml:id="class.stdclass" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||
|
||
<title>stdClass sınıfı</title>
|
||
<titleabbrev>stdClass</titleabbrev>
|
||
|
||
<partintro>
|
||
|
||
<section xml:id="stdclass.intro">
|
||
&reftitle.intro;
|
||
<para>
|
||
Dinamik özellikleri olabilen boş genel sınıf.
|
||
</para>
|
||
|
||
<para>
|
||
Bu sınıfın nesneleri <link linkend="language.oop5.basic.new">new</link>
|
||
işleci ile örneklenerek veya
|
||
<link linkend="language.types.object.casting">nesneye dönüşümle</link>
|
||
oluşturulabilir. Ayrıca, <function>json_decode</function>,
|
||
<function>mysqli_fetch_object</function>,
|
||
<methodname>PDOStatement::fetchObject</methodname> gibi çeşitli PHP
|
||
işlevleri de bu sınıfın örneklerini oluşturabilir.
|
||
</para>
|
||
|
||
<para>
|
||
<link linkend="object.get">__get()</link>/<link linkend="object.set">__set()</link>
|
||
sihirli yöntemlerini uygulamamasına rağmen, bu sınıf dinamik özelliklere
|
||
izin verir ve <code>#[\AllowDynamicProperties]</code> özniteliğini
|
||
gerektirmez.
|
||
</para>
|
||
|
||
<para>
|
||
PHP'nin evrensel temel sınıf kavramı olmadığı için bu temel bir sınıf
|
||
değildir. Ancak, <classname>stdClass</classname>'tan genişleyen ve sonuç
|
||
olarak dinamik özelliklerin işlevselliğini devralan özel bir sınıf
|
||
oluşturmak mümkündür.
|
||
</para>
|
||
</section>
|
||
|
||
<section xml:id="stdclass.synopsis">
|
||
&reftitle.classsynopsis;
|
||
|
||
<classsynopsis class="class">
|
||
<ooclass>
|
||
<classname>stdClass</classname>
|
||
</ooclass>
|
||
</classsynopsis>
|
||
|
||
<para>
|
||
Bu sınıfın yöntemleri ve öntanımlı özellikleri yoktur.
|
||
</para>
|
||
</section>
|
||
|
||
<section xml:id="stdclass.examples" role="examples">
|
||
&reftitle.examples;
|
||
<example xml:id="stdclass.basic-example">
|
||
<title>- Tür dönüşümüyle nesneye dönüştürerek örnekleme</title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
$obj = (object) array('foo' => 'bar');
|
||
var_dump($obj);
|
||
]]>
|
||
</programlisting>
|
||
&example.outputs;
|
||
<screen>
|
||
<![CDATA[
|
||
object(stdClass)#1 (1) {
|
||
["foo"]=>
|
||
string(3) "bar"
|
||
}
|
||
]]>
|
||
</screen>
|
||
</example>
|
||
<example xml:id="stdclass.json-example">
|
||
<title>- <function>json_decode</function> ile örnekleme</title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
$json = '{"foo":"bar"}';
|
||
var_dump(json_decode($json));
|
||
]]>
|
||
</programlisting>
|
||
&example.outputs;
|
||
<screen>
|
||
<![CDATA[
|
||
object(stdClass)#1 (1) {
|
||
["foo"]=>
|
||
string(3) "bar"
|
||
}
|
||
]]>
|
||
</screen>
|
||
</example>
|
||
<example xml:id="stdclass.properties-example">
|
||
<title>- Dinamik özelliklerin bildirilmesi</title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
$obj = new stdClass();
|
||
$obj->foo = 42;
|
||
$obj->{1} = 42;
|
||
var_dump($obj);
|
||
]]>
|
||
</programlisting>
|
||
&example.outputs;
|
||
<screen>
|
||
<![CDATA[
|
||
object(stdClass)#1 (2) {
|
||
["foo"]=>
|
||
int(42)
|
||
["1"]=>
|
||
int(42)
|
||
}
|
||
]]>
|
||
</screen>
|
||
</example>
|
||
</section>
|
||
|
||
</partintro>
|
||
|
||
</reference>
|
||
<!-- 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
|
||
-->
|