{"id":14980,"date":"2020-06-16T08:09:53","date_gmt":"2020-06-16T08:09:53","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=14980"},"modified":"2022-04-28T09:15:24","modified_gmt":"2022-04-28T09:15:24","slug":"php-syntax","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/php-syntax\/","title":{"rendered":"PHP 7 Fundamental Tutorial for Beginners \u2013 PHP Syntax"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Standard PHP Syntax<\/h4>\n\n\n\n<p>One of the first scripts is run on the server, and the simple result results are sent back to the browser.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Basic PHP Syntax<\/h4>\n\n\n\n<p>one PHP script starts with the .<br>A print file always contains a html tag and some print script code<\/p>\n\n\n\n<p>In the following example, instead of Simple Hatmall, only the first file has an example in which<br>The first is a script that shows the code &#8220;hello world&#8221; that uses the &#8220;echo&#8221; function code in the code.<br>On a web page.<\/p>\n\n\n\n<p><strong>Example<\/strong><\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/SushantSinghRajput03\/b758a0d9472fff045f437c1e6c436ac0.js\"><\/script>\n\n\n\n<p>Every PHP statement end with a semicolon (;) \u2014 this tells the PHP engine that the end of the current statement has been reached.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Embedding PHP within HTML<\/h4>\n\n\n\n<p>The first file is a simple file with the .oh extension. Inside a first file we can write html code Like we do in the html file, and also on the server side we can show the first code as we have given below.<\/p>\n\n\n\n<p><strong>Example<\/strong><\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/SushantSinghRajput03\/11e9c9e201a5984c57a7d5348d65a748.js\"><\/script>\n\n\n\n<p>As in the example given above, we have told you to PHP the code inside the HTML<br>How to combine code to create a dynamic web page created in a simple way. If the results show the code on the path of the web page, then the difference that you will see is the first code &lt;! First echo &#8220;Hello, World!&#8221; | The &#8221; replaced with the output &#8220;Hello, world!&#8221;.<\/p>\n\n\n\n<p>when you run this code the PHP engine executed the instructions between the tags and leave the rest of the thing as it is. At the end, the webserver send the final output back to your browser which is completely in HTML.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">PHP Comments<\/h4>\n\n\n\n<p>A comment is a code in which PHP ignores files. The commenting command makes the code more attractive.Or it is easy to explain to the other developer what the code is coded<br>(Or when we look at the first code in the future, we can easily find out what has happened or not)<\/p>\n\n\n\n<p>PHP support single-line as well as multi-line comments. To write a single-line comment either start the line with either two slashes (\/\/) or a hash symbol (#). For example:<\/p>\n\n\n\n<p><strong>Example<\/strong><\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/SushantSinghRajput03\/062004bbf1bf759784e19c0efb9a9b60.js\"><\/script>\n\n\n\n<p>Currently slash followed bean asterisk (\/ ) at the beginning of a comment to write with a multi-line comment. Asterisk followed by a slash ( \/) at the end of the comment and comment. Are being given<\/p>\n\n\n\n<p><strong>Example<\/strong><\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/SushantSinghRajput03\/9c76fc7f66bb945e0a8359b657ac66d6.js\"><\/script>\n\n\n\n<h4 class=\"wp-block-heading\">Case Sensitivity in PHP<\/h4>\n\n\n\n<p>In PHP, keywords (e.g. if, else, while, echo, etc.), classes, functions, and user-defined functions are not case-sensitive.<\/p>\n\n\n\n<p>In the example below, all three echo statements below are equal and legal:<\/p>\n\n\n\n<p><strong>Example<\/strong><\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/SushantSinghRajput03\/61730189076c231d7d3d41f8891056c8.js\"><\/script>\n\n\n\n<p>Variable names in PHP are case-sensitive. As a result the variables $color, $Color and $COLOR are treated as three different variables.<\/p>\n\n\n\n<p><strong>Example<\/strong><\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/SushantSinghRajput03\/19e3a1c64807bae0a2fcb80b247346cd.js\"><\/script>\n\n\n\n<p>If you try to run the above example code it will only display the value of the variable $color and produce the &#8220;Undefined variable&#8221; warning for the variable $Color and $COLOR.<\/p>\n\n\n\n<p>However the keywords, function and classes names are case-insensitive. As a result calling the gettype() or GETTYPE() produce the same result.<\/p>\n\n\n\n<p><strong>Example<\/strong><\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/SushantSinghRajput03\/63426d476b149ae4952782bd10ec7a05.js\"><\/script>\n\n\n\n<p>If you try to run the above example code both the functions gettype() and GETTYPE() gives the same output, which is: string.<\/p>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_55293\"><iframe loading=\"lazy\"  id=\"_ytid_44362\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_55293\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Standard PHP Syntax One of the first scripts is run on the server, and the simple result results are sent back to the browser. Basic PHP Syntax one PHP script&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5150],"tags":[],"class_list":["post-14980","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/14980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=14980"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/14980\/revisions"}],"predecessor-version":[{"id":24760,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/14980\/revisions\/24760"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=14980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=14980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=14980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}