{"id":176,"date":"2009-12-14T16:53:59","date_gmt":"2009-12-14T23:53:59","guid":{"rendered":"https:\/\/www.artisticimposter.com\/blog\/?p=176"},"modified":"2009-12-14T16:53:59","modified_gmt":"2009-12-14T23:53:59","slug":"variables-and-data-types-in-php","status":"publish","type":"post","link":"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/","title":{"rendered":"Variables and Data Types in PHP"},"content":{"rendered":"<p><em>Continued from <a href=\"https:\/\/www.artisticimposter.com\/blog\/understanding-variables\/\">Understanding Variables<\/a>:<\/em><\/p>\n<p>PHP variables must also conform to a set of rules. Variable names must start with a dollar sign. They can contain any combination of strings, numbers, and underscores, but the first character after the dollar sign cannot be a number. PHP variables are also case-sensitive.<\/p>\n<p>PHP variables don&#8217;t need an initial value when they are created, and they don&#8217;t need to be declared a specific data type either.<\/p>\n<p>PHP has several built-in data types:<\/p>\n<ul>\n<li><em>boolean<\/em> &#8211; a data type with only two possible values: <em>true<\/em> or <em>false<\/em><\/li>\n<li><em>integer<\/em> &#8211; any positive or negative whole number, or a zero<\/li>\n<li><em>float<\/em> &#8211; numbers that are too large or too small to be represented as integers<\/li>\n<li><em>string<\/em> &#8211; a series of alphanumeric characters, numbers, and punctuation marks<\/li>\n<li><em>array<\/em> &#8211; a data type which can hold several different values<\/li>\n<li><em>object<\/em> &#8211; built-in or user-defined classes of data; a collection of properties or attributes<\/li>\n<li><em>resource<\/em> &#8211; a variable holding a reference to an external resource, like a MySQL database<\/li>\n<li><em>NULL<\/em> &#8211; a special data value that has no value and means nothing; not the same as zero<\/li>\n<\/ul>\n<p>When using integers, a leading 0 ( zero ) is used to specify that the integer is octal, and a leading 0x or 0X is used to specify hexadecimal. A floating point number can contain either a decimal or an &#8220;e&#8221; to represent &#8220;ten to the power of&#8221; in scientific notation, or both.<\/p>\n<p><em>Note: ActionScript and JavaScript also use arrays, but they aren&#8217;t listed as a basic data type in the official documentation, as far as I&#8217;ve been able to discover, while arrays are listed as one of the eight main data types supported by PHP. While most of us just use arrays without considering whether they are a data type or not, I have endeavored to follow the various documentation in these articles. I apologize for any confusion this may cause.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Continued from Understanding Variables: PHP variables must also conform to a set of rules. Variable names must start with a dollar sign. They can contain any combination of strings, numbers, and underscores, but the first character after the dollar sign cannot be a number. PHP variables are also case-sensitive. PHP variables don&#8217;t need an initial &hellip; <a href=\"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Variables and Data Types in PHP&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[50,42],"tags":[31,51,41,43],"class_list":["post-176","post","type-post","status-publish","format-standard","hentry","category-php-tutorials","category-tutorials","tag-php","tag-programming","tag-tips","tag-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Variables and Data Types in PHP | Artistic Imposter Design<\/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:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Variables and Data Types in PHP | Artistic Imposter Design\" \/>\n<meta property=\"og:description\" content=\"Continued from Understanding Variables: PHP variables must also conform to a set of rules. Variable names must start with a dollar sign. They can contain any combination of strings, numbers, and underscores, but the first character after the dollar sign cannot be a number. PHP variables are also case-sensitive. PHP variables don&#8217;t need an initial &hellip; Continue reading &quot;Variables and Data Types in PHP&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/\" \/>\n<meta property=\"og:site_name\" content=\"Artistic Imposter Design\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/artisticimposter\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/kbwashburn\" \/>\n<meta property=\"article:published_time\" content=\"2009-12-14T23:53:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.artisticimposter.com\/blog\/wp-content\/uploads\/2020\/12\/title.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"275\" \/>\n\t<meta property=\"og:image:height\" content=\"82\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Brad\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bradwashburn\" \/>\n<meta name=\"twitter:site\" content=\"@bradwashburn\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brad\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/\"},\"author\":{\"name\":\"Brad\",\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/#\/schema\/person\/2204a26e0617b620cb00fdb1d0111660\"},\"headline\":\"Variables and Data Types in PHP\",\"datePublished\":\"2009-12-14T23:53:59+00:00\",\"dateModified\":\"2009-12-14T23:53:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/\"},\"wordCount\":321,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/#organization\"},\"keywords\":[\"PHP\",\"Programming\",\"Tips\",\"Tutorials\"],\"articleSection\":[\"PHP\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/\",\"url\":\"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/\",\"name\":\"Variables and Data Types in PHP | Artistic Imposter Design\",\"isPartOf\":{\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/#website\"},\"datePublished\":\"2009-12-14T23:53:59+00:00\",\"dateModified\":\"2009-12-14T23:53:59+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.artisticimposter.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Variables and Data Types in PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/#website\",\"url\":\"https:\/\/www.artisticimposter.com\/blog\/\",\"name\":\"Artistic Imposter Design\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.artisticimposter.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/#organization\",\"name\":\"Artistic Imposter Design\",\"url\":\"https:\/\/www.artisticimposter.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.artisticimposter.com\/blog\/wp-content\/uploads\/2020\/12\/cropped-logo.png\",\"contentUrl\":\"https:\/\/www.artisticimposter.com\/blog\/wp-content\/uploads\/2020\/12\/cropped-logo.png\",\"width\":512,\"height\":512,\"caption\":\"Artistic Imposter Design\"},\"image\":{\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/artisticimposter\",\"https:\/\/x.com\/bradwashburn\",\"https:\/\/www.instagram.com\/artisticimposterdesign\/\",\"https:\/\/www.linkedin.com\/company\/artistic-imposter-design\",\"https:\/\/www.youtube.com\/channel\/UC_SGOHbnI9Cy7byzKbQCFlA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/#\/schema\/person\/2204a26e0617b620cb00fdb1d0111660\",\"name\":\"Brad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.artisticimposter.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2bddfdea63dd2fdf76c199b2a705d0c374dbd6013cd40dedbc25663d4837e381?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2bddfdea63dd2fdf76c199b2a705d0c374dbd6013cd40dedbc25663d4837e381?s=96&d=mm&r=g\",\"caption\":\"Brad\"},\"sameAs\":[\"https:\/\/artisticimposter.com\",\"https:\/\/www.facebook.com\/kbwashburn\",\"https:\/\/www.instagram.com\/artisticimposterdesign\/\",\"https:\/\/www.linkedin.com\/in\/kbradleywashburn\/\",\"https:\/\/x.com\/bradwashburn\",\"https:\/\/www.youtube.com\/channel\/UC_SGOHbnI9Cy7byzKbQCFlA\"],\"url\":\"https:\/\/www.artisticimposter.com\/blog\/author\/kbwashburn\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Variables and Data Types in PHP | Artistic Imposter Design","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:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/","og_locale":"en_US","og_type":"article","og_title":"Variables and Data Types in PHP | Artistic Imposter Design","og_description":"Continued from Understanding Variables: PHP variables must also conform to a set of rules. Variable names must start with a dollar sign. They can contain any combination of strings, numbers, and underscores, but the first character after the dollar sign cannot be a number. PHP variables are also case-sensitive. PHP variables don&#8217;t need an initial &hellip; Continue reading \"Variables and Data Types in PHP\"","og_url":"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/","og_site_name":"Artistic Imposter Design","article_publisher":"https:\/\/www.facebook.com\/artisticimposter","article_author":"https:\/\/www.facebook.com\/kbwashburn","article_published_time":"2009-12-14T23:53:59+00:00","og_image":[{"width":275,"height":82,"url":"https:\/\/www.artisticimposter.com\/blog\/wp-content\/uploads\/2020\/12\/title.jpg","type":"image\/jpeg"}],"author":"Brad","twitter_card":"summary_large_image","twitter_creator":"@bradwashburn","twitter_site":"@bradwashburn","twitter_misc":{"Written by":"Brad","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/#article","isPartOf":{"@id":"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/"},"author":{"name":"Brad","@id":"https:\/\/www.artisticimposter.com\/blog\/#\/schema\/person\/2204a26e0617b620cb00fdb1d0111660"},"headline":"Variables and Data Types in PHP","datePublished":"2009-12-14T23:53:59+00:00","dateModified":"2009-12-14T23:53:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/"},"wordCount":321,"commentCount":0,"publisher":{"@id":"https:\/\/www.artisticimposter.com\/blog\/#organization"},"keywords":["PHP","Programming","Tips","Tutorials"],"articleSection":["PHP","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/","url":"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/","name":"Variables and Data Types in PHP | Artistic Imposter Design","isPartOf":{"@id":"https:\/\/www.artisticimposter.com\/blog\/#website"},"datePublished":"2009-12-14T23:53:59+00:00","dateModified":"2009-12-14T23:53:59+00:00","breadcrumb":{"@id":"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.artisticimposter.com\/blog\/variables-and-data-types-in-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.artisticimposter.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Variables and Data Types in PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.artisticimposter.com\/blog\/#website","url":"https:\/\/www.artisticimposter.com\/blog\/","name":"Artistic Imposter Design","description":"","publisher":{"@id":"https:\/\/www.artisticimposter.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.artisticimposter.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.artisticimposter.com\/blog\/#organization","name":"Artistic Imposter Design","url":"https:\/\/www.artisticimposter.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.artisticimposter.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.artisticimposter.com\/blog\/wp-content\/uploads\/2020\/12\/cropped-logo.png","contentUrl":"https:\/\/www.artisticimposter.com\/blog\/wp-content\/uploads\/2020\/12\/cropped-logo.png","width":512,"height":512,"caption":"Artistic Imposter Design"},"image":{"@id":"https:\/\/www.artisticimposter.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/artisticimposter","https:\/\/x.com\/bradwashburn","https:\/\/www.instagram.com\/artisticimposterdesign\/","https:\/\/www.linkedin.com\/company\/artistic-imposter-design","https:\/\/www.youtube.com\/channel\/UC_SGOHbnI9Cy7byzKbQCFlA"]},{"@type":"Person","@id":"https:\/\/www.artisticimposter.com\/blog\/#\/schema\/person\/2204a26e0617b620cb00fdb1d0111660","name":"Brad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.artisticimposter.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/2bddfdea63dd2fdf76c199b2a705d0c374dbd6013cd40dedbc25663d4837e381?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2bddfdea63dd2fdf76c199b2a705d0c374dbd6013cd40dedbc25663d4837e381?s=96&d=mm&r=g","caption":"Brad"},"sameAs":["https:\/\/artisticimposter.com","https:\/\/www.facebook.com\/kbwashburn","https:\/\/www.instagram.com\/artisticimposterdesign\/","https:\/\/www.linkedin.com\/in\/kbradleywashburn\/","https:\/\/x.com\/bradwashburn","https:\/\/www.youtube.com\/channel\/UC_SGOHbnI9Cy7byzKbQCFlA"],"url":"https:\/\/www.artisticimposter.com\/blog\/author\/kbwashburn\/"}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.artisticimposter.com\/blog\/wp-json\/wp\/v2\/posts\/176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.artisticimposter.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.artisticimposter.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.artisticimposter.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.artisticimposter.com\/blog\/wp-json\/wp\/v2\/comments?post=176"}],"version-history":[{"count":0,"href":"https:\/\/www.artisticimposter.com\/blog\/wp-json\/wp\/v2\/posts\/176\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.artisticimposter.com\/blog\/wp-json\/wp\/v2\/media?parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.artisticimposter.com\/blog\/wp-json\/wp\/v2\/categories?post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.artisticimposter.com\/blog\/wp-json\/wp\/v2\/tags?post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}