{"id":6541,"date":"2021-06-21T13:13:45","date_gmt":"2021-06-21T13:13:45","guid":{"rendered":"https:\/\/www.scmgalaxy.com\/tutorials\/?p=6541"},"modified":"2022-04-13T16:33:35","modified_gmt":"2022-04-13T16:33:35","slug":"what-is-php-define-variables-and-datatypes-how-to-use-it","status":"publish","type":"post","link":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-php-define-variables-and-datatypes-how-to-use-it\/","title":{"rendered":"What is php? Define variables and Datatypes how to use it?"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In this tutorial i&#8217;m going to explore about what is PHP and their datatypes and how to use of variables. <br>PHP is a open-source side programming language that is specially suited for web development and can be embeded to HTML. It is powerful to hold a content management system like WordPress and can be used to control user access. PHP can actually do anything related to server-side scripting or more popularly known as the backend of a website, it is more secure and reliable to be used as a server-side scripting language.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What is DataTypes?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Datatypes is a range of all different data can be given variable in PHP. It&#8217;s supports these string.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>String<\/li><li>Integer<\/li><li>Float (floating point numbers &#8211; also called double)<\/li><li>Boolean<\/li><li>Array<\/li><li>Object<\/li><li>NULL<\/li><li>Resource<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How to write datatypes in PHP?<\/strong><\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/laravelamit\/91622ec9dc31b0fe6de3600a6efcb8e6.js\"><\/script>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>string:-  <\/strong>A\u00a0<strong>string<\/strong>\u00a0is a data type used in programming, string is  a sequence of character its  supports a 256-character. The simplest way to create a string is to enclose the string literal (i.e. string characters) in single quotation marks (&#8216;), like this:      <br><br>$my_string\u00a0= &#8216;Hello World&#8217;;<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">2. Integer:-  An integer is a number without any decimal part.<br><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php  \n    $x=123;  \n    echo $x;  \n?&gt;  <\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Float:- A float is a number with a decimal point as like- 2.0, 256.4, 10.358, 7.64E+5, 5.56E-5 are all\u00a0<em>floats<\/em>.\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4. Boolean:- A boolean data can be either TRUE or FALSE. These are predefined constants in PHP.<br><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nvar_dump((bool) -2);        \/\/ bool(true)\nvar_dump((bool) &quot;foo&quot;);     \/\/ bool(true)\nvar_dump((bool) 2.3e5);     \/\/ bool(true)\nvar_dump((bool) array(12)); \/\/ bool(true)\nvar_dump((bool) array());   \/\/ bool(false)\nvar_dump((bool) &quot;false&quot;);   \/\/ bool(true)\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><br>5. array:- An array stores multiple values in one single variable.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;?php<br>$cars =\u00a0array(&#8220;Volvo&#8221;,&#8221;BMW&#8221;,&#8221;Toyota&#8221;);<br>var_dump($cars);<br>?><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">6. Object:- Objects are the instances of user-defined classes that can store both values and functions. They must be explicitly declared.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/laravelamit\/e594c734e8f63abdd2f25e3af5d05a78.js\"><\/script>\n\n\n\n<p class=\"wp-block-paragraph\">7. Null:- Null is a special data type which can have only one value Null, if variable is created without a value it is automatically assigned a value of Null.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">8. Resource:-  Resources are not the exact data type in PHP. Resource is the storing the refrenece to functions call or refrences to external PHP resource as like database. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial i&#8217;m going to explore about what is PHP and their datatypes and how to use of variables. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5388],"tags":[5400,5401,177,5045],"class_list":["post-6541","post","type-post","status-publish","format-standard","hentry","category-php","tag-datatypes","tag-loop","tag-php","tag-variable"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What is php? Define variables and Datatypes how to use it? - scmGalaxy<\/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.scmgalaxy.com\/tutorials\/what-is-php-define-variables-and-datatypes-how-to-use-it\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is php? Define variables and Datatypes how to use it? - scmGalaxy\" \/>\n<meta property=\"og:description\" content=\"In this tutorial i&#8217;m going to explore about what is PHP and their datatypes and how to use of variables. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-php-define-variables-and-datatypes-how-to-use-it\/\" \/>\n<meta property=\"og:site_name\" content=\"scmGalaxy\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-21T13:13:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-13T16:33:35+00:00\" \/>\n<meta name=\"author\" content=\"rajeshkumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rajeshkumar\" \/>\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.scmgalaxy.com\\\/tutorials\\\/what-is-php-define-variables-and-datatypes-how-to-use-it\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-php-define-variables-and-datatypes-how-to-use-it\\\/\"},\"author\":{\"name\":\"rajeshkumar\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"headline\":\"What is php? Define variables and Datatypes how to use it?\",\"datePublished\":\"2021-06-21T13:13:45+00:00\",\"dateModified\":\"2022-04-13T16:33:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-php-define-variables-and-datatypes-how-to-use-it\\\/\"},\"wordCount\":342,\"commentCount\":0,\"keywords\":[\"datatypes\",\"loop\",\"Php\",\"Variable\"],\"articleSection\":[\"php\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-php-define-variables-and-datatypes-how-to-use-it\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-php-define-variables-and-datatypes-how-to-use-it\\\/\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-php-define-variables-and-datatypes-how-to-use-it\\\/\",\"name\":\"What is php? Define variables and Datatypes how to use it? - scmGalaxy\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\"},\"datePublished\":\"2021-06-21T13:13:45+00:00\",\"dateModified\":\"2022-04-13T16:33:35+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-php-define-variables-and-datatypes-how-to-use-it\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-php-define-variables-and-datatypes-how-to-use-it\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/what-is-php-define-variables-and-datatypes-how-to-use-it\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What is php? Define variables and Datatypes how to use it?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/\",\"name\":\"scmGalaxy\",\"description\":\"A Platform for Software Engineers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/a40e0dd38feee7c2779460a804d49361\",\"name\":\"rajeshkumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g\",\"caption\":\"rajeshkumar\"},\"url\":\"https:\\\/\\\/www.scmgalaxy.com\\\/tutorials\\\/author\\\/rajeshkumar\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is php? Define variables and Datatypes how to use it? - scmGalaxy","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.scmgalaxy.com\/tutorials\/what-is-php-define-variables-and-datatypes-how-to-use-it\/","og_locale":"en_US","og_type":"article","og_title":"What is php? Define variables and Datatypes how to use it? - scmGalaxy","og_description":"In this tutorial i&#8217;m going to explore about what is PHP and their datatypes and how to use of variables. [&hellip;]","og_url":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-php-define-variables-and-datatypes-how-to-use-it\/","og_site_name":"scmGalaxy","article_published_time":"2021-06-21T13:13:45+00:00","article_modified_time":"2022-04-13T16:33:35+00:00","author":"rajeshkumar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rajeshkumar","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-php-define-variables-and-datatypes-how-to-use-it\/#article","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-php-define-variables-and-datatypes-how-to-use-it\/"},"author":{"name":"rajeshkumar","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"headline":"What is php? Define variables and Datatypes how to use it?","datePublished":"2021-06-21T13:13:45+00:00","dateModified":"2022-04-13T16:33:35+00:00","mainEntityOfPage":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-php-define-variables-and-datatypes-how-to-use-it\/"},"wordCount":342,"commentCount":0,"keywords":["datatypes","loop","Php","Variable"],"articleSection":["php"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.scmgalaxy.com\/tutorials\/what-is-php-define-variables-and-datatypes-how-to-use-it\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-php-define-variables-and-datatypes-how-to-use-it\/","url":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-php-define-variables-and-datatypes-how-to-use-it\/","name":"What is php? Define variables and Datatypes how to use it? - scmGalaxy","isPartOf":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website"},"datePublished":"2021-06-21T13:13:45+00:00","dateModified":"2022-04-13T16:33:35+00:00","author":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361"},"breadcrumb":{"@id":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-php-define-variables-and-datatypes-how-to-use-it\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.scmgalaxy.com\/tutorials\/what-is-php-define-variables-and-datatypes-how-to-use-it\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/what-is-php-define-variables-and-datatypes-how-to-use-it\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.scmgalaxy.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"What is php? Define variables and Datatypes how to use it?"}]},{"@type":"WebSite","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#website","url":"https:\/\/www.scmgalaxy.com\/tutorials\/","name":"scmGalaxy","description":"A Platform for Software Engineers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.scmgalaxy.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.scmgalaxy.com\/tutorials\/#\/schema\/person\/a40e0dd38feee7c2779460a804d49361","name":"rajeshkumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/82337e1fc8642c7f36795aa0775af055a4f38882994004b593efd31758d4434e?s=96&d=mm&r=g","caption":"rajeshkumar"},"url":"https:\/\/www.scmgalaxy.com\/tutorials\/author\/rajeshkumar\/"}]}},"_links":{"self":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/6541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/comments?post=6541"}],"version-history":[{"count":1,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/6541\/revisions"}],"predecessor-version":[{"id":6545,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/posts\/6541\/revisions\/6545"}],"wp:attachment":[{"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/media?parent=6541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/categories?post=6541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scmgalaxy.com\/tutorials\/wp-json\/wp\/v2\/tags?post=6541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}