{"id":112,"date":"2017-05-25T11:29:03","date_gmt":"2017-05-25T04:29:03","guid":{"rendered":"https:\/\/dangnhsite.wordpress.com\/?p=112"},"modified":"2018-01-02T05:03:36","modified_gmt":"2018-01-02T05:03:36","slug":"what-is-stdclass-and-dynamic-properties-in-php","status":"publish","type":"post","link":"https:\/\/dangnh.cf\/vi\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/","title":{"rendered":"What is stdClass? And Dynamic Properties in PHP?"},"content":{"rendered":"<p>Well hello there, I\u2019m back <img decoding=\"async\" class=\"emoji\" src=\"https:\/\/s.w.org\/images\/core\/emoji\/2.2.1\/svg\/1f642.svg\" alt=\"\ud83d\ude42\" \/><\/p>\n<p>If you are a curious person, like me, you must have wandered in the core code of PHP frameworks like Laravel or Yii, and you must have seen this\u00a0<strong>stdClass<\/strong> here and there. Now, let\u2019s see what is that and how it helps us to code cleaner and more efficient.<\/p>\n<p>Okay if you came from or know even just a little Java, you\u2019ll familiar with this concept called\u00a0<strong>Dynamic Properties<\/strong>, to create a new object in Java somehow it\u2019ll look like this:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nconst x = {\r\n    a: 'test',\r\n    b: 'test2',\r\n    c: 'test3'\r\n};\r\n<\/pre>\n<div class=\"crayon-line\">Well, before PHP 5.4 object\u2019s properties must be predefined before we can set or get it with the <em>magic method<\/em>. What a bumper! But luckily, now we can define a new object as quick and dynamic as this:<\/div>\n<div class=\"crayon-line\">\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$book = new stdClass;\r\n$book-&gt;title = &quot;Harry Potter and the Prisoner of Azkaban&quot;;\r\n$book-&gt;author = &quot;J. K. Rowling&quot;;\r\n$book-&gt;publisher = &quot;Arthur A. Levine Books&quot;;\r\n$book-&gt;amazon_link = &quot;http:\/\/www.amazon.com\/dp\/0439136369\/&quot;;\r\n<\/pre>\n<\/div>\n<div class=\"crayon-line\">\n<div class=\"crayon-line\">\n<p>See?\u00a0Sometimes all that is necessary is a property bag to throw key value pairs into. One way is to use array, but this requires quoting all keys.\u00a0Another way is to use dynamic properties on an instance of <strong>StdClass<\/strong>. <strong>StdClass<\/strong> is a sparsely documented class in PHP which has no predefined properties.<\/p>\n<p>You can even cast an array directly to an object in a sec:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$array = array(\r\n    &quot;title&quot; =&gt; &quot;Harry Potter and the Prisoner of Azkaban&quot;,\r\n    &quot;author&quot; =&gt; &quot;J. K. Rowling&quot;,\r\n    &quot;publisher&quot; =&gt; &quot;Arthur A. Levine Books&quot;,\r\n    &quot;amazon_link&quot; =&gt; &quot;http:\/\/www.amazon.com\/dp\/0439136369\/&quot;\r\n);\r\n \r\n$books = (object) $array;\r\n<\/pre>\n<div class=\"crayon-line crayon-striped-line\">\n<p>To conclusion,\u00a0Objects are really useful when you\u2019re working with a large data structure, as you can have an object with nested sub-arrays in it. And\u00a0<strong>StdClass\u00a0<\/strong>(<em>std<\/em> stand for <em>standard<\/em>)is just a generic \u2019empty bag\u2019 class that\u2019s used when casting other types to objects with what ever properties you want in them. <strong>BUT\u00a0<\/strong>despite what the others say, <strong>StdClass\u00a0<\/strong>is <strong>not<\/strong> the base class for objects in PHP. Please remember that.<\/p>\n<p>Next week I\u2019ll be back with you guys to discuss about\u00a0<strong>Trait\u00a0<\/strong><img decoding=\"async\" class=\"emoji\" src=\"https:\/\/s.w.org\/images\/core\/emoji\/2.2.1\/svg\/1f609.svg\" alt=\"\ud83d\ude09\" \/> See ya<\/p>\n<p style=\"text-align:right;\">Dang.NH<\/p>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Well hello there, I\u2019m back If you are a curious person, like me, you must have wandered in the core code of PHP frameworks like Laravel or Yii, and you must have seen this\u00a0stdClass here and there. Now, let\u2019s see what is that and how it helps us to code cleaner and more efficient. Okay if you came from or know even just a little Java, you\u2019ll familiar with this concept called\u00a0Dynamic Properties, to create a new object in Java somehow it\u2019ll look like this: const x = { a: &#8216;test&#8217;, b: &#8216;test2&#8217;, c: &#8216;test3&#8217; }; Well, before PHP 5.4 object\u2019s properties must be predefined before we can set or get it with the magic method. What a bumper! But luckily, now we can define a new object as quick and dynamic as this: $book = new stdClass; $book-&gt;title = &quot;Harry Potter and the Prisoner of Azkaban&quot;; $book-&gt;author = &quot;J. K. Rowling&quot;; $book-&gt;publisher = &quot;Arthur A. Levine Books&quot;; $book-&gt;amazon_link = &quot;http:\/\/www.amazon.com\/dp\/0439136369\/&quot;; See?\u00a0Sometimes all that is necessary is a property bag to throw key value pairs into. One way is to use array, but this requires quoting all keys.\u00a0Another way is to use dynamic properties on an instance of StdClass. StdClass is a sparsely documented class in PHP which has no predefined properties. You can even cast an array directly to an object in a sec: $array = array( &quot;title&quot; =&gt; &quot;Harry Potter and the Prisoner of Azkaban&quot;, &quot;author&quot; =&gt; &quot;J. K. Rowling&quot;, &quot;publisher&quot; =&gt; &quot;Arthur A. Levine Books&quot;, &quot;amazon_link&quot; =&gt; &quot;http:\/\/www.amazon.com\/dp\/0439136369\/&quot; ); $books = (object) $array; To conclusion,\u00a0Objects are really useful when you\u2019re working with a large data structure, as you can have an object with nested sub-arrays in it. And\u00a0StdClass\u00a0(std stand for standard)is just a generic \u2019empty bag\u2019 class that\u2019s used when casting other types to objects with what ever properties you want in them. BUT\u00a0despite what the others say, StdClass\u00a0is not the base class for objects in PHP. Please remember that. Next week I\u2019ll be back with you guys to discuss about\u00a0Trait\u00a0 See ya Dang.NH<\/p>","protected":false},"author":1,"featured_media":122,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5],"tags":[],"class_list":["post-112","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What is stdClass? And Dynamic Properties in PHP? - Mark&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dangnh.cf\/vi\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is stdClass? And Dynamic Properties in PHP? - Mark&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"Well hello there, I\u2019m back If you are a curious person, like me, you must have wandered in the core code of PHP frameworks like Laravel or Yii, and you must have seen this\u00a0stdClass here and there. Now, let\u2019s see what is that and how it helps us to code cleaner and more efficient. Okay if you came from or know even just a little Java, you\u2019ll familiar with this concept called\u00a0Dynamic Properties, to create a new object in Java somehow it\u2019ll look like this: const x = { a: &#039;test&#039;, b: &#039;test2&#039;, c: &#039;test3&#039; }; Well, before PHP 5.4 object\u2019s properties must be predefined before we can set or get it with the magic method. What a bumper! But luckily, now we can define a new object as quick and dynamic as this: $book = new stdClass; $book-&gt;title = &quot;Harry Potter and the Prisoner of Azkaban&quot;; $book-&gt;author = &quot;J. K. Rowling&quot;; $book-&gt;publisher = &quot;Arthur A. Levine Books&quot;; $book-&gt;amazon_link = &quot;http:\/\/www.amazon.com\/dp\/0439136369\/&quot;; See?\u00a0Sometimes all that is necessary is a property bag to throw key value pairs into. One way is to use array, but this requires quoting all keys.\u00a0Another way is to use dynamic properties on an instance of StdClass. StdClass is a sparsely documented class in PHP which has no predefined properties. You can even cast an array directly to an object in a sec: $array = array( &quot;title&quot; =&gt; &quot;Harry Potter and the Prisoner of Azkaban&quot;, &quot;author&quot; =&gt; &quot;J. K. Rowling&quot;, &quot;publisher&quot; =&gt; &quot;Arthur A. Levine Books&quot;, &quot;amazon_link&quot; =&gt; &quot;http:\/\/www.amazon.com\/dp\/0439136369\/&quot; ); $books = (object) $array; To conclusion,\u00a0Objects are really useful when you\u2019re working with a large data structure, as you can have an object with nested sub-arrays in it. And\u00a0StdClass\u00a0(std stand for standard)is just a generic \u2019empty bag\u2019 class that\u2019s used when casting other types to objects with what ever properties you want in them. BUT\u00a0despite what the others say, StdClass\u00a0is not the base class for objects in PHP. Please remember that. Next week I\u2019ll be back with you guys to discuss about\u00a0Trait\u00a0 See ya Dang.NH\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dangnh.cf\/vi\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/\" \/>\n<meta property=\"og:site_name\" content=\"Mark&#039;s Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/dangtute\" \/>\n<meta property=\"article:published_time\" content=\"2017-05-25T04:29:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-01-02T05:03:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dangnh.cf\/wp-content\/uploads\/2017\/05\/stdclass-trong-php.png\" \/>\n\t<meta property=\"og:image:width\" content=\"365\" \/>\n\t<meta property=\"og:image:height\" content=\"268\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 ph\u00fat\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/dangnh.cf\\\/2017\\\/05\\\/25\\\/what-is-stdclass-and-dynamic-properties-in-php\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/dangnh.cf\\\/2017\\\/05\\\/25\\\/what-is-stdclass-and-dynamic-properties-in-php\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/dangnh.cf\\\/#\\\/schema\\\/person\\\/8f3b9db3b250186af217fbeec88eda9c\"},\"headline\":\"What is stdClass? And Dynamic Properties in PHP?\",\"datePublished\":\"2017-05-25T04:29:03+00:00\",\"dateModified\":\"2018-01-02T05:03:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/dangnh.cf\\\/2017\\\/05\\\/25\\\/what-is-stdclass-and-dynamic-properties-in-php\\\/\"},\"wordCount\":407,\"commentCount\":1,\"image\":{\"@id\":\"https:\\\/\\\/dangnh.cf\\\/2017\\\/05\\\/25\\\/what-is-stdclass-and-dynamic-properties-in-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/dangnh.cf\\\/wp-content\\\/uploads\\\/2017\\\/05\\\/stdclass-trong-php.png?fit=365%2C268&ssl=1\",\"articleSection\":[\"PHP\"],\"inLanguage\":\"vi\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/dangnh.cf\\\/2017\\\/05\\\/25\\\/what-is-stdclass-and-dynamic-properties-in-php\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/dangnh.cf\\\/2017\\\/05\\\/25\\\/what-is-stdclass-and-dynamic-properties-in-php\\\/\",\"url\":\"https:\\\/\\\/dangnh.cf\\\/2017\\\/05\\\/25\\\/what-is-stdclass-and-dynamic-properties-in-php\\\/\",\"name\":\"What is stdClass? And Dynamic Properties in PHP? - Mark's Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/dangnh.cf\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/dangnh.cf\\\/2017\\\/05\\\/25\\\/what-is-stdclass-and-dynamic-properties-in-php\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/dangnh.cf\\\/2017\\\/05\\\/25\\\/what-is-stdclass-and-dynamic-properties-in-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/dangnh.cf\\\/wp-content\\\/uploads\\\/2017\\\/05\\\/stdclass-trong-php.png?fit=365%2C268&ssl=1\",\"datePublished\":\"2017-05-25T04:29:03+00:00\",\"dateModified\":\"2018-01-02T05:03:36+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/dangnh.cf\\\/#\\\/schema\\\/person\\\/8f3b9db3b250186af217fbeec88eda9c\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/dangnh.cf\\\/2017\\\/05\\\/25\\\/what-is-stdclass-and-dynamic-properties-in-php\\\/#breadcrumb\"},\"inLanguage\":\"vi\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/dangnh.cf\\\/2017\\\/05\\\/25\\\/what-is-stdclass-and-dynamic-properties-in-php\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\\\/\\\/dangnh.cf\\\/2017\\\/05\\\/25\\\/what-is-stdclass-and-dynamic-properties-in-php\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/dangnh.cf\\\/wp-content\\\/uploads\\\/2017\\\/05\\\/stdclass-trong-php.png?fit=365%2C268&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/dangnh.cf\\\/wp-content\\\/uploads\\\/2017\\\/05\\\/stdclass-trong-php.png?fit=365%2C268&ssl=1\",\"width\":365,\"height\":268},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/dangnh.cf\\\/2017\\\/05\\\/25\\\/what-is-stdclass-and-dynamic-properties-in-php\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/dangnh.cf\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What is stdClass? And Dynamic Properties in PHP?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/dangnh.cf\\\/#website\",\"url\":\"https:\\\/\\\/dangnh.cf\\\/\",\"name\":\"Mark's Blog\",\"description\":\"A blog about Programming and Technical Stuffs\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/dangnh.cf\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"vi\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/dangnh.cf\\\/#\\\/schema\\\/person\\\/8f3b9db3b250186af217fbeec88eda9c\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d838feab6bbd5e774c608b656a29ab0d54981b88fa4b563a83d7635108b6c76e?s=96&d=retro&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d838feab6bbd5e774c608b656a29ab0d54981b88fa4b563a83d7635108b6c76e?s=96&d=retro&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d838feab6bbd5e774c608b656a29ab0d54981b88fa4b563a83d7635108b6c76e?s=96&d=retro&r=g\",\"caption\":\"admin\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is stdClass? And Dynamic Properties in PHP? - Mark's Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dangnh.cf\/vi\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/","og_locale":"vi_VN","og_type":"article","og_title":"What is stdClass? And Dynamic Properties in PHP? - Mark's Blog","og_description":"Well hello there, I\u2019m back If you are a curious person, like me, you must have wandered in the core code of PHP frameworks like Laravel or Yii, and you must have seen this\u00a0stdClass here and there. Now, let\u2019s see what is that and how it helps us to code cleaner and more efficient. Okay if you came from or know even just a little Java, you\u2019ll familiar with this concept called\u00a0Dynamic Properties, to create a new object in Java somehow it\u2019ll look like this: const x = { a: 'test', b: 'test2', c: 'test3' }; Well, before PHP 5.4 object\u2019s properties must be predefined before we can set or get it with the magic method. What a bumper! But luckily, now we can define a new object as quick and dynamic as this: $book = new stdClass; $book-&gt;title = &quot;Harry Potter and the Prisoner of Azkaban&quot;; $book-&gt;author = &quot;J. K. Rowling&quot;; $book-&gt;publisher = &quot;Arthur A. Levine Books&quot;; $book-&gt;amazon_link = &quot;http:\/\/www.amazon.com\/dp\/0439136369\/&quot;; See?\u00a0Sometimes all that is necessary is a property bag to throw key value pairs into. One way is to use array, but this requires quoting all keys.\u00a0Another way is to use dynamic properties on an instance of StdClass. StdClass is a sparsely documented class in PHP which has no predefined properties. You can even cast an array directly to an object in a sec: $array = array( &quot;title&quot; =&gt; &quot;Harry Potter and the Prisoner of Azkaban&quot;, &quot;author&quot; =&gt; &quot;J. K. Rowling&quot;, &quot;publisher&quot; =&gt; &quot;Arthur A. Levine Books&quot;, &quot;amazon_link&quot; =&gt; &quot;http:\/\/www.amazon.com\/dp\/0439136369\/&quot; ); $books = (object) $array; To conclusion,\u00a0Objects are really useful when you\u2019re working with a large data structure, as you can have an object with nested sub-arrays in it. And\u00a0StdClass\u00a0(std stand for standard)is just a generic \u2019empty bag\u2019 class that\u2019s used when casting other types to objects with what ever properties you want in them. BUT\u00a0despite what the others say, StdClass\u00a0is not the base class for objects in PHP. Please remember that. Next week I\u2019ll be back with you guys to discuss about\u00a0Trait\u00a0 See ya Dang.NH","og_url":"https:\/\/dangnh.cf\/vi\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/","og_site_name":"Mark's Blog","article_publisher":"https:\/\/www.facebook.com\/dangtute","article_published_time":"2017-05-25T04:29:03+00:00","article_modified_time":"2018-01-02T05:03:36+00:00","og_image":[{"width":365,"height":268,"url":"https:\/\/dangnh.cf\/wp-content\/uploads\/2017\/05\/stdclass-trong-php.png","type":"image\/png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"admin","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"2 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/dangnh.cf\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/#article","isPartOf":{"@id":"https:\/\/dangnh.cf\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/"},"author":{"name":"admin","@id":"https:\/\/dangnh.cf\/#\/schema\/person\/8f3b9db3b250186af217fbeec88eda9c"},"headline":"What is stdClass? And Dynamic Properties in PHP?","datePublished":"2017-05-25T04:29:03+00:00","dateModified":"2018-01-02T05:03:36+00:00","mainEntityOfPage":{"@id":"https:\/\/dangnh.cf\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/"},"wordCount":407,"commentCount":1,"image":{"@id":"https:\/\/dangnh.cf\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2017\/05\/stdclass-trong-php.png?fit=365%2C268&ssl=1","articleSection":["PHP"],"inLanguage":"vi","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/dangnh.cf\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/dangnh.cf\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/","url":"https:\/\/dangnh.cf\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/","name":"What is stdClass? And Dynamic Properties in PHP? - Mark's Blog","isPartOf":{"@id":"https:\/\/dangnh.cf\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dangnh.cf\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/#primaryimage"},"image":{"@id":"https:\/\/dangnh.cf\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2017\/05\/stdclass-trong-php.png?fit=365%2C268&ssl=1","datePublished":"2017-05-25T04:29:03+00:00","dateModified":"2018-01-02T05:03:36+00:00","author":{"@id":"https:\/\/dangnh.cf\/#\/schema\/person\/8f3b9db3b250186af217fbeec88eda9c"},"breadcrumb":{"@id":"https:\/\/dangnh.cf\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dangnh.cf\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/dangnh.cf\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/#primaryimage","url":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2017\/05\/stdclass-trong-php.png?fit=365%2C268&ssl=1","contentUrl":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2017\/05\/stdclass-trong-php.png?fit=365%2C268&ssl=1","width":365,"height":268},{"@type":"BreadcrumbList","@id":"https:\/\/dangnh.cf\/2017\/05\/25\/what-is-stdclass-and-dynamic-properties-in-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dangnh.cf\/"},{"@type":"ListItem","position":2,"name":"What is stdClass? And Dynamic Properties in PHP?"}]},{"@type":"WebSite","@id":"https:\/\/dangnh.cf\/#website","url":"https:\/\/dangnh.cf\/","name":"Mark's Blog","description":"A blog about Programming and Technical Stuffs","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dangnh.cf\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Person","@id":"https:\/\/dangnh.cf\/#\/schema\/person\/8f3b9db3b250186af217fbeec88eda9c","name":"admin","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/secure.gravatar.com\/avatar\/d838feab6bbd5e774c608b656a29ab0d54981b88fa4b563a83d7635108b6c76e?s=96&d=retro&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d838feab6bbd5e774c608b656a29ab0d54981b88fa4b563a83d7635108b6c76e?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d838feab6bbd5e774c608b656a29ab0d54981b88fa4b563a83d7635108b6c76e?s=96&d=retro&r=g","caption":"admin"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2017\/05\/stdclass-trong-php.png?fit=365%2C268&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9w3NP-1O","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":124,"url":"https:\/\/dangnh.cf\/vi\/2017\/05\/25\/stdclass-la-gi-lam-the-nao-de-co-properties-dong-trong-php\/","url_meta":{"origin":112,"position":0},"title":"stdClass l\u00e0 g\u00ec? L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 c\u00f3 Dynamic Properties trong PHP?","author":"admin","date":"Th\u00e1ng 5 25, 2017","format":false,"excerpt":"Ch\u00e0o c\u00e1c b\u1ea1n, m\u00ecnh l\u00e0 \u0110\u0103ng, v\u00e0 m\u00ecnh \u0111\u00e3 tr\u1edf l\u1ea1i r\u1ed3i \u0111\u00e2yy\u00a0 N\u1ebfu b\u1ea1n l\u00e0 1 ng\u01b0\u1eddi r\u1ea5t hay t\u00f2 m\u00f2 ngh\u1ecbch ng\u1ee3m, gi\u1ed1ng t\u00f4i, th\u00ec ch\u1eafc h\u1eb3n b\u1ea1n \u0111\u00e3 t\u1eebng lang thang trong core c\u1ee7a m\u1ea5y th\u1eb1ng PHP framework nh\u01b0 Laravel hay Yii, v\u00e0 ch\u1eafc cmn c\u00fa l\u00e0\u2026","rel":"","context":"Trong &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/dangnh.cf\/vi\/category\/web-development\/php\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2017\/05\/stdclass-trong-php.png?fit=365%2C268&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":211,"url":"https:\/\/dangnh.cf\/vi\/2018\/06\/01\/trait-mixin-in-php\/","url_meta":{"origin":112,"position":1},"title":"Trait &#8211; Mixin in PHP?","author":"admin","date":"Th\u00e1ng 6 1, 2018","format":false,"excerpt":"Hi guys :) Nh\u01b0 c\u00e1c b\u1ea1n c\u00f3 l\u1ebd \u0111\u00e3 bi\u1ebft, PHP l\u00e0 1 ng\u00f4n ng\u1eef single inheritance, t\u1ee9c l\u00e0 n\u00f3 s\u1ebd c\u00f3 1 s\u1ed1 nh\u01b0\u1ee3c \u0111i\u1ec3m nh\u01b0: M\u1ea5t th\u1eddi gian & c\u00f4ng s\u1ee9c khi t\u00ecm hi\u1ec3u\/ch\u1ea1y h\u1ec7 th\u1ed1ng. V\u00ed d\u1ee5: 1 class c\u00f3 10 levels c\u00e1c class cha, th\u00ec v\u1ec1\u2026","rel":"","context":"Trong &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/dangnh.cf\/vi\/category\/web-development\/php\/"},"img":{"alt_text":"Trait in PHP","src":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2018\/06\/retro-background-3101430_960_720.jpg?fit=960%2C540&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2018\/06\/retro-background-3101430_960_720.jpg?fit=960%2C540&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2018\/06\/retro-background-3101430_960_720.jpg?fit=960%2C540&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2018\/06\/retro-background-3101430_960_720.jpg?fit=960%2C540&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":367,"url":"https:\/\/dangnh.cf\/vi\/2020\/01\/20\/service-container-di-sanh-dieu-voi-laravel\/","url_meta":{"origin":112,"position":2},"title":"Service Container &#038; DI &#8220;s\u00e0nh \u0111i\u1ec7u&#8221; v\u1edbi Laravel","author":"admin","date":"Th\u00e1ng 1 20, 2020","format":false,"excerpt":"Hi, long time no see :D Laravel l\u00e0 m\u1ed9t framework n\u1ed5i ti\u1ebfng nh\u1ea5t trong c\u1ed9ng \u0111\u1ed3ng PHP, 1 ph\u1ea7n l\u00e0 v\u00ec c\u1ea5u tr\u00fac tuy\u1ec7t v\u1eddi c\u1ee7a n\u00f3. Khi n\u00f3i \u0111\u1ebfn architectural concepts c\u1ee7a Laravel, kh\u00f4ng th\u1ec3 kh\u00f4ng nh\u1eafc t\u1edbi Service Container. Khi b\u1ea1n \u0111\u1ee5ng \u0111\u1ebfn 1 b\u00e0i to\u00e1n l\u1edbn h\u01a1n,\u2026","rel":"","context":"Trong &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/dangnh.cf\/vi\/category\/web-development\/php\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2020\/01\/1_SstfI6yiEWj1mrnFrLTUdA-e1579505803935.jpeg?fit=900%2C600&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2020\/01\/1_SstfI6yiEWj1mrnFrLTUdA-e1579505803935.jpeg?fit=900%2C600&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2020\/01\/1_SstfI6yiEWj1mrnFrLTUdA-e1579505803935.jpeg?fit=900%2C600&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2020\/01\/1_SstfI6yiEWj1mrnFrLTUdA-e1579505803935.jpeg?fit=900%2C600&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":43,"url":"https:\/\/dangnh.cf\/vi\/2016\/04\/06\/variable-debug-in-yii-2\/","url_meta":{"origin":112,"position":3},"title":"Debug variables in Yii 2","author":"admin","date":"Th\u00e1ng 4 6, 2016","format":false,"excerpt":"Debug variables in Yii 2","rel":"","context":"Trong &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/dangnh.cf\/vi\/category\/web-development\/php\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2016\/04\/debug-excel.jpg?fit=640%2C388&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2016\/04\/debug-excel.jpg?fit=640%2C388&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2016\/04\/debug-excel.jpg?fit=640%2C388&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":283,"url":"https:\/\/dangnh.cf\/vi\/2018\/01\/12\/setup-nginx-php-mysql-phpmyadmin-macos-high-sierra\/","url_meta":{"origin":112,"position":4},"title":"Setup Nginx, PHP, MySQL and phpMyAdmin on macOS High Sierra","author":"admin","date":"Th\u00e1ng 1 12, 2018","format":false,"excerpt":"Recently I bought a Mac and with all the curiosity, I upgraded to the newest OS which is High Sierra. I heard a lot about the ease of setting up development environment on Mac with package manager like brew Beside, I have used Linux and Windows simultaneously for almost a\u2026","rel":"","context":"Trong &quot;Environment&quot;","block_context":{"text":"Environment","link":"https:\/\/dangnh.cf\/vi\/category\/web-development\/environment\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2018\/01\/mac-for-hackers-set-up-homebrew-install-update-open-source-tools.1280x600.jpg?fit=1200%2C563&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2018\/01\/mac-for-hackers-set-up-homebrew-install-update-open-source-tools.1280x600.jpg?fit=1200%2C563&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2018\/01\/mac-for-hackers-set-up-homebrew-install-update-open-source-tools.1280x600.jpg?fit=1200%2C563&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2018\/01\/mac-for-hackers-set-up-homebrew-install-update-open-source-tools.1280x600.jpg?fit=1200%2C563&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2018\/01\/mac-for-hackers-set-up-homebrew-install-update-open-source-tools.1280x600.jpg?fit=1200%2C563&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":66,"url":"https:\/\/dangnh.cf\/vi\/2017\/05\/19\/lam-toan-giai-tri-mot-ti-nhi\/","url_meta":{"origin":112,"position":5},"title":"L\u00e0m to\u00e1n gi\u1ea3i tr\u00ed m\u1ed9t t\u00ed nh\u1ec9?","author":"admin","date":"Th\u00e1ng 5 19, 2017","format":false,"excerpt":"Ok, ch\u00e0o t\u1ea5t c\u1ea3 anh em Ch\u1ea3 l\u00e0 cu\u1ed1i tu\u1ea7n, \u1edf nh\u00e0 r\u1ea3nh rang, tr\u1eddi th\u00ec se se l\u1ea1nh, m\u0169i h\u01a1i t\u1eafc, ch\u1ec9 mu\u1ed1n co ro qu\u1ea5n ch\u0103n \u00f4m laptop cho \u1ea5m. Lang thang thi c\u00e1i cu\u1ed9c thi l\u1eadp tr\u00ecnh c\u1ee7a b\u1ecdn Top Career g\u00ec \u0111\u00f3 :v v\u00f4 t\u00ecnh v\u1ea5p\u2026","rel":"","context":"Trong &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/dangnh.cf\/vi\/category\/web-development\/php\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2017\/05\/learning_math-e1459355151809.jpg?fit=800%2C513&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2017\/05\/learning_math-e1459355151809.jpg?fit=800%2C513&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2017\/05\/learning_math-e1459355151809.jpg?fit=800%2C513&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/dangnh.cf\/wp-content\/uploads\/2017\/05\/learning_math-e1459355151809.jpg?fit=800%2C513&ssl=1&resize=700%2C400 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/dangnh.cf\/vi\/wp-json\/wp\/v2\/posts\/112","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dangnh.cf\/vi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dangnh.cf\/vi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dangnh.cf\/vi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dangnh.cf\/vi\/wp-json\/wp\/v2\/comments?post=112"}],"version-history":[{"count":2,"href":"https:\/\/dangnh.cf\/vi\/wp-json\/wp\/v2\/posts\/112\/revisions"}],"predecessor-version":[{"id":269,"href":"https:\/\/dangnh.cf\/vi\/wp-json\/wp\/v2\/posts\/112\/revisions\/269"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dangnh.cf\/vi\/wp-json\/wp\/v2\/media\/122"}],"wp:attachment":[{"href":"https:\/\/dangnh.cf\/vi\/wp-json\/wp\/v2\/media?parent=112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dangnh.cf\/vi\/wp-json\/wp\/v2\/categories?post=112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dangnh.cf\/vi\/wp-json\/wp\/v2\/tags?post=112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}