{"id":1799,"date":"2021-06-23T22:48:48","date_gmt":"2021-06-23T19:48:48","guid":{"rendered":"https:\/\/www.etemkeskin.com\/?p=1799"},"modified":"2021-06-23T22:48:51","modified_gmt":"2021-06-23T19:48:51","slug":"php-de-sihirli-sabitler","status":"publish","type":"post","link":"https:\/\/www.etemkeskin.com\/index.php\/tr\/2021\/06\/23\/php-de-sihirli-sabitler\/","title":{"rendered":"PHP&#8217; de Sihirli Sabitler"},"content":{"rendered":"\n<p>PHP&#8217; de \u00e7e\u015fitli extension&#8217; larla birlikte gelen \u00f6n tan\u0131ml\u0131 sabitler vard\u0131r. Bu sabitleri bilmek bizim PHP&#8217; yi daha etkin kullanmam\u0131z\u0131 sa\u011flar.<\/p>\n\n\n\n<h4>1.) <strong><code>__LINE__<\/code><\/strong><\/h4>\n\n\n\n<p>Kullan\u0131ld\u0131\u011f\u0131 yerdeki sat\u0131r numaras\u0131n\u0131 getirir.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;php&quot;,&quot;mime&quot;:&quot;text\/x-php&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;showPanel&quot;:false,&quot;language&quot;:&quot;PHP&quot;,&quot;modeName&quot;:&quot;php&quot;}\">echo &quot;Sat\u0131r numaras\u0131 : &quot;. __LINE__;\n\n\/\/\u00c7IKTI: Sat\u0131r numaras\u0131 : 2<\/pre><\/div>\n\n\n\n<h4>2.) <strong><code>__FILE__<\/code><\/strong><\/h4>\n\n\n\n<p>Dosya yolu ve dosya ismini getirir.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;php&quot;,&quot;mime&quot;:&quot;text\/x-php&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;showPanel&quot;:false,&quot;language&quot;:&quot;PHP&quot;,&quot;modeName&quot;:&quot;php&quot;}\">echo &quot;Dosya yolu : &quot;. __FILE__;\n\n\/\/\u00c7IKTI: Dosya yolu : C:\\Bitnami\\wampstack-7.3.25-0\\apache2\\htdocs\\learn-lara\\app\\Http\\Controllers\\FrontController.php<\/pre><\/div>\n\n\n\n<h4>3.) <strong><code>__DIR__<\/code><\/strong><\/h4>\n\n\n\n<p>Dosyan\u0131n bulundu\u011fu dizini d\u00f6nd\u00fcr\u00fcr.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;php&quot;,&quot;mime&quot;:&quot;text\/x-php&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;showPanel&quot;:false,&quot;language&quot;:&quot;PHP&quot;,&quot;modeName&quot;:&quot;php&quot;}\">echo &quot;Klas\u00f6r yolu : &quot;. __FILE__;\n\n\/\/\u00c7IKTI: Klas\u00f6r yolu : C:\\Bitnami\\wampstack-7.3.25-0\\apache2\\htdocs\\learn-lara\\app\\Http\\Controllers<\/pre><\/div>\n\n\n\n<h4>4.) <strong><code>__FUNCTION__<\/code><\/strong><\/h4>\n\n\n\n<p>Bir fonksiyonun i\u00e7inde kullan\u0131ld\u0131\u011f\u0131nda i\u00e7inde bulundu\u011fu fonksiyonun ismini getirir.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;php&quot;,&quot;mime&quot;:&quot;text\/x-php&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;showPanel&quot;:false,&quot;language&quot;:&quot;PHP&quot;,&quot;modeName&quot;:&quot;php&quot;}\">public function myFunction()\n    {\n  \t\techo &quot;Fonksiyon ismi : &quot;. __FUNCTION__;\n\t}\n\n\/\/\u00c7IKTI: Fonksiyon ismi : myFunction<\/pre><\/div>\n\n\n\n<h4>5.) <strong><code>__CLASS__<\/code><\/strong><\/h4>\n\n\n\n<p>Bir s\u0131n\u0131f\u0131n i\u00e7inde kullan\u0131ld\u0131\u011f\u0131nda i\u00e7inde bulundu\u011fu s\u0131n\u0131f\u0131n ismini getirir. Trait&#8217; ler i\u00e7inde de kullan\u0131l\u0131r.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;php&quot;,&quot;mime&quot;:&quot;text\/x-php&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;showPanel&quot;:false,&quot;language&quot;:&quot;PHP&quot;,&quot;modeName&quot;:&quot;php&quot;}\">class FooBar\n{\n    public function getClassName(){\n        return __CLASS__;\n    }\n}\n$obj = new FooBar();\necho $obj-&gt;getClassName();\n\n\/\/\u00c7IKTI: FooBar<\/pre><\/div>\n\n\n\n<h4>6.) <strong><code>__TRAIT__<\/code><\/strong><\/h4>\n\n\n\n<p>Bir trait&#8217; in i\u00e7inde kullan\u0131ld\u0131\u011f\u0131nda i\u00e7inde bulundu\u011fu traitin ismini getirir.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;php&quot;,&quot;mime&quot;:&quot;text\/x-php&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;showPanel&quot;:false,&quot;language&quot;:&quot;PHP&quot;,&quot;modeName&quot;:&quot;php&quot;}\">trait FooBarTrait{  \n    function myTraitFunction(){  \n        echo __TRAIT__;  \n        }  \n    }  \n    class Student{  \n        use FooBarTrait;  \n        }  \n    $a = new Company;  \n    $a-&gt;myTraitFunction(); \n\n\/\/\u00c7IKTI: FooBarTrait<\/pre><\/div>\n\n\n\n<h4>7.) <strong><code>__METHOD__<\/code><\/strong><\/h4>\n\n\n\n<p>Kullan\u0131ld\u0131\u011f\u0131 metodun ismini getirir.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;php&quot;,&quot;mime&quot;:&quot;text\/x-php&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;showPanel&quot;:false,&quot;language&quot;:&quot;PHP&quot;,&quot;modeName&quot;:&quot;php&quot;}\">class Student\n{\n    public function myClassMethod(){\n        return __METHOD__;\n    }\n}\n$obj = new Student();\necho  $obj-&gt;myClassMethod();\n\n\/\/\u00c7IKTI: myClassMethod<\/pre><\/div>\n\n\n\n<h4>8.) <strong><code>__NAMESPACE__<\/code><\/strong><\/h4>\n\n\n\n<p>Ge\u00e7erli isim alan\u0131n\u0131 getirir.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;php&quot;,&quot;mime&quot;:&quot;text\/x-php&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;showPanel&quot;:false,&quot;language&quot;:&quot;PHP&quot;,&quot;modeName&quot;:&quot;php&quot;}\">namespace FooBarNamespace;\n  \nclass Student {\n    public function myMethod() {\n        return __NAMESPACE__;\n    }\n}\n  \n$obj = new Company();\necho  $obj-&gt;myMethod(); \n  \n\/\/\u00c7IKTI: FooBarNamespace<\/pre><\/div>\n\n\n\n<h4>9.) <strong><code>S\u0131n\u0131fAd\u0131::class<\/code><\/strong><\/h4>\n\n\n\n<p>Kullan\u0131ld\u0131\u011f\u0131 s\u0131n\u0131f\u0131n i\u00e7inde s\u0131n\u0131f\u0131n namespace ile birlikte tam ad\u0131n\u0131 getirir. <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;php&quot;,&quot;mime&quot;:&quot;text\/x-php&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;showPanel&quot;:false,&quot;language&quot;:&quot;PHP&quot;,&quot;modeName&quot;:&quot;php&quot;}\">namespace FooBarNamespace;\nclass Student{ }\n  \necho Geeks::class;\n\n\/\/\u00c7IKTI: FooBarNamespace\\Student<\/pre><\/div>\n\n\n\n<p>Ba\u015far\u0131lar.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP&#8217; de \u00e7e\u015fitli extension&#8217; larla birlikte gelen \u00f6n tan\u0131ml\u0131 sabitler vard\u0131r. Bu sabitleri bilmek bizim PHP&#8217; yi daha etkin kullanmam\u0131z\u0131 sa\u011flar. 1.) __LINE__ Kullan\u0131ld\u0131\u011f\u0131 yerdeki sat\u0131r numaras\u0131n\u0131 getirir. 2.) __FILE__ Dosya yolu ve dosya ismini getirir. 3.) __DIR__ Dosyan\u0131n bulundu\u011fu dizini d\u00f6nd\u00fcr\u00fcr. 4.) __FUNCTION__ Bir fonksiyonun i\u00e7inde kullan\u0131ld\u0131\u011f\u0131nda i\u00e7inde bulundu\u011fu fonksiyonun ismini getirir. 5.) __CLASS__ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18,28],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PHP&#039; de Sihirli Sabitler - blog website<\/title>\n<meta name=\"description\" content=\"PHP&#039; de Sihirli Sabitler. PHP&#039; de \u00e7e\u015fitli extension&#039; larla birlikte gelen \u00f6n tan\u0131ml\u0131 sabitler vard\u0131r. Bu sabitleri bilmek bizim PHP&#039; yi daha etkin kullanmam\u0131z\u0131 sa\u011flar.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.etemkeskin.com\/index.php\/tr\/2021\/06\/23\/php-de-sihirli-sabitler\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP&#039; de Sihirli Sabitler - blog website\" \/>\n<meta property=\"og:description\" content=\"PHP&#039; de Sihirli Sabitler. PHP&#039; de \u00e7e\u015fitli extension&#039; larla birlikte gelen \u00f6n tan\u0131ml\u0131 sabitler vard\u0131r. Bu sabitleri bilmek bizim PHP&#039; yi daha etkin kullanmam\u0131z\u0131 sa\u011flar.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.etemkeskin.com\/index.php\/tr\/2021\/06\/23\/php-de-sihirli-sabitler\/\" \/>\n<meta property=\"og:site_name\" content=\"blog website\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-23T19:48:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-23T19:48:51+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.etemkeskin.com\/#website\",\"url\":\"https:\/\/www.etemkeskin.com\/\",\"name\":\"blog website\",\"description\":\"Etem KESK\\u0130N\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.etemkeskin.com\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"tr\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.etemkeskin.com\/index.php\/tr\/2021\/06\/23\/php-de-sihirli-sabitler\/#webpage\",\"url\":\"https:\/\/www.etemkeskin.com\/index.php\/tr\/2021\/06\/23\/php-de-sihirli-sabitler\/\",\"name\":\"PHP' de Sihirli Sabitler - blog website\",\"isPartOf\":{\"@id\":\"https:\/\/www.etemkeskin.com\/#website\"},\"datePublished\":\"2021-06-23T19:48:48+00:00\",\"dateModified\":\"2021-06-23T19:48:51+00:00\",\"author\":{\"@id\":\"https:\/\/www.etemkeskin.com\/#\/schema\/person\/dcbc30282861ce578b96a79ce8789629\"},\"description\":\"PHP' de Sihirli Sabitler. PHP' de \\u00e7e\\u015fitli extension' larla birlikte gelen \\u00f6n tan\\u0131ml\\u0131 sabitler vard\\u0131r. Bu sabitleri bilmek bizim PHP' yi daha etkin kullanmam\\u0131z\\u0131 sa\\u011flar.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.etemkeskin.com\/index.php\/tr\/2021\/06\/23\/php-de-sihirli-sabitler\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.etemkeskin.com\/index.php\/tr\/2021\/06\/23\/php-de-sihirli-sabitler\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.etemkeskin.com\/index.php\/tr\/2021\/06\/23\/php-de-sihirli-sabitler\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Ana sayfa\",\"item\":\"https:\/\/www.etemkeskin.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PHP&#8217; de Sihirli Sabitler\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.etemkeskin.com\/#\/schema\/person\/dcbc30282861ce578b96a79ce8789629\",\"name\":\"etemkeskin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.etemkeskin.com\/#personlogo\",\"inLanguage\":\"tr\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6af0148b790691ed24ae245fb3dc773b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6af0148b790691ed24ae245fb3dc773b?s=96&d=mm&r=g\",\"caption\":\"etemkeskin\"},\"url\":\"https:\/\/www.etemkeskin.com\/index.php\/author\/etemkeskinyahoo-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/posts\/1799"}],"collection":[{"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/comments?post=1799"}],"version-history":[{"count":1,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/posts\/1799\/revisions"}],"predecessor-version":[{"id":1800,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/posts\/1799\/revisions\/1800"}],"wp:attachment":[{"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/media?parent=1799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/categories?post=1799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.etemkeskin.com\/index.php\/wp-json\/wp\/v2\/tags?post=1799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}