Skip to content

How to create an object in PHP?

$x = (object) [
    'a' => 'test',
    'b' => 'test2',
    'c' => 'test3'

object(stdClass)#1 (3) {
  string(4) "test"
  string(5) "test2"
  string(5) "test3"
See also  Python code snippet - How to Inserting a Node Into a Sorted Doubly Linked List?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.