{"id":9905,"date":"2020-02-03T13:05:34","date_gmt":"2020-02-03T13:05:34","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=9905"},"modified":"2021-11-13T05:44:53","modified_gmt":"2021-11-13T05:44:53","slug":"what-is-a-client-server-internal-data-types-and-variables-in-php","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/what-is-a-client-server-internal-data-types-and-variables-in-php\/","title":{"rendered":"What is a client, Server, Internal Data Types, and Variables in PHP?"},"content":{"rendered":"\n<h1 class=\"has-text-align-center wp-block-heading\"><em>Php Introduction<\/em><\/h1>\n\n\n\n<p>PHP is an open Source Server-side programming\/ Scripting language that suited for web development and can be embedded into HTML. PHP stands for Hypertext Preprocessor But it&#8217;s original name is Personal HomePage. it was developed in 1994. It runs in various platforms like Windows, Linux, Mac, etc. It is compatible with almost all servers like Apache, IIS, etc. Its File Extension is .php.<\/p>\n\n\n\n<h1 class=\"has-text-align-center wp-block-heading\"><em>What is a client?<\/em><\/h1>\n\n\n\n<p> A client is a piece of computer hardware or software that accesses a service which made available by Server. For example, a web browser is clients that connect to web servers and retrieve web pages for display.<\/p>\n\n\n\n<h1 class=\"has-text-align-center wp-block-heading\"><em>What is a Server?<\/em><\/h1>\n\n\n\n<p> a server is a Computer program or a device that provides functionality for other programs or a device called client.<\/p>\n\n\n\n<p>Ex- A client requests for a webpage then server finds that webpage and display on the client&#8217;s screen.<\/p>\n\n\n\n<h1 class=\"has-text-align-center wp-block-heading\"><em>Client-Server Architecture?<\/em><\/h1>\n\n\n\n<p><strong><em>i. 2-tier Architecture <\/em>&#8211;<\/strong> In this architecture, only two are involved. First who request, and 2nd Who Fulfill the request. It means, Client Directly communicates with the Server and Sends request, and the server responds to the client.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"787\" height=\"297\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/2-tier-Architecture.png\" alt=\"\" class=\"wp-image-9907\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/2-tier-Architecture.png 787w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/2-tier-Architecture-300x113.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/2-tier-Architecture-768x290.png 768w\" sizes=\"auto, (max-width: 787px) 100vw, 787px\" \/><\/figure>\n\n\n\n<p><em><strong>ii. 3-tier Architecture<\/strong><\/em> &#8211; In this architecture, there is a middleware is used to fulfil the request. When a Client request for a webpage, then application server first check-in data source that the requested webpage is available or not, if available then the server responds to the Client.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"836\" height=\"279\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/3-tier-Architecture.png\" alt=\"\" class=\"wp-image-9908\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/3-tier-Architecture.png 836w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/3-tier-Architecture-300x100.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/3-tier-Architecture-768x256.png 768w\" sizes=\"auto, (max-width: 836px) 100vw, 836px\" \/><\/figure>\n\n\n\n<h1 class=\"has-text-align-center wp-block-heading\"><em>What is a Web Browser?<\/em><\/h1>\n\n\n\n<p>A Web browser is a client, program, software or tool through which we send an HTTP request to the Web Server. It knows how to communicate with the server. The main purpose of a web browser is to locate the content on the World Wide Web and display the pages, images, audio, and videos. For example- Google Chrome, Mozilla Firefox, etc. <\/p>\n\n\n\n<h1 class=\"has-text-align-center wp-block-heading\"><em>What is a Web Server? <\/em><\/h1>\n\n\n\n<p>A Web Server can be either a software or hardware unit, which provides the web pages via HTTP. It gets the request and find the resources, then respond to the Client. Web Server provides services only for web applications. All communication between client and server takes place through HTTP. For Example- tomcat, IIS, SMTP, FTP etc.<\/p>\n\n\n\n<p><em><strong>Web Server Architecture<\/strong><\/em> &#8211; When Client Sends a request for a webpage, then Web Server first check that the requested page\/source is available or not, if available then Web Server sends the request to the client and display.  <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"839\" height=\"380\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/Web-Server-Architecture.png\" alt=\"\" class=\"wp-image-9909\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/Web-Server-Architecture.png 839w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/Web-Server-Architecture-300x136.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/Web-Server-Architecture-768x348.png 768w\" sizes=\"auto, (max-width: 839px) 100vw, 839px\" \/><\/figure>\n\n\n\n<h1 class=\"has-text-align-center wp-block-heading\"><em>How PHP Works?<\/em><\/h1>\n\n\n\n<p>When a Client request for a Webpage (suppose tutorial.php) to the server(here server is Apache) then server sends the request to the PHP interpreter which converts the request into machine language and then search that page in database, if the page was found in the database then it comes to PHP interpreter and interpreter sends the data to the Web Server. Now, Web Server sends the request-response to the client. See the below Image.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"767\" height=\"371\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/How-PHP-Works.png\" alt=\"\" class=\"wp-image-9911\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/How-PHP-Works.png 767w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/02\/How-PHP-Works-300x145.png 300w\" sizes=\"auto, (max-width: 767px) 100vw, 767px\" \/><\/figure>\n\n\n\n<h1 class=\"has-text-align-center wp-block-heading\"><em>Variables in PHP?<\/em><\/h1>\n\n\n\n<p> Variables are containers which are used to store information.<br> Types of variable :- <br> i. Local variable.<br> ii. Globle variable.<br> iii. Static variable.<\/p>\n\n\n\n<h3 class=\"has-text-align-center wp-block-heading\"><em>How to declare a variable in PHP?<\/em><\/h3>\n\n\n\n<p> In PHP, Variable names begin with $ sign, followed by a name.<br> For Example &#8211; <strong>$roll<\/strong><br>                           <strong>$price<\/strong><br>                           <strong>$name<\/strong><\/p>\n\n\n\n<h3 class=\"has-text-align-center wp-block-heading\"><em>Rules of Variable names?<\/em><\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>Variable start with $ sign.<\/li><li>Variable name only starts with a letter, an underscore(_).<\/li><li>A variable name cannot start with a number.<\/li><li>It is case sensitive which implies that the variable <strong>num<\/strong> in lowercase is different from <strong>NUM<\/strong> in uppercase.<\/li><li>Do not use predefined constant name e.g. PHP_VERSION, PHP_OS etc.<\/li><li>Do not use a reserved keyword. e.g. else, if etc.<\/li><\/ul>\n\n\n\n<h3 class=\"has-text-align-center wp-block-heading\"><em>How to Initialise Variables?<\/em><\/h3>\n\n\n\n<p>PHP can store all type of data in variables. Before using a variable in PHP, assign a value to it so PHP will create that variable and store data in it. That means we have to assign data to a variable before attempting to read a variable&#8217;s value.<br> For Example &#8211; <strong>$roll = 256;<\/strong><br>                          <strong> $price = 23.28;<\/strong><br>                           <strong>$name = Sushant;<\/strong>     <br><strong><em>Note <\/em><\/strong>&#8211; If a Variable is created without a value, it is automatically assigned a value NULL.<\/p>\n\n\n\n<h1 class=\"has-text-align-center wp-block-heading\"><em>Internal Data Types<\/em><\/h1>\n\n\n\n<p> In other languages, you need to specify the exact data format of each variable, but PHP handles that for you.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Integer: It can hold the whole number. Ex: 12,0,-34 etc<\/li><li>Float\/Double: It can hold a floating-point number. Ex: 26.35658, 3.25 etc<\/li><li>String: It can hold text or group of characters. Ex: &#8220;Sushant Kumar&#8221; etc.<\/li><li>Boolean: It can hold true\/false value.<\/li><li>Array: It can hold multiple values in one single variable.<\/li><li>Object: It can hold programming objects.<\/li><li>NULL: It can hold only one value &#8211; NULL.<\/li><\/ul>\n\n\n\n<p>Click Here For Next Part &#8211; <a href=\"https:\/\/www.devopsschool.com\/blog\/echo-statement-print-statement-and-here-document-in-php\/\">Echo Statement, Print Statement, and Here document in PHP.<\/a><\/p>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_73791\"><figure class=\"wp-block-embed wp-block-embed-youtube is-type-video is-provider-youtube epyt-figure\"><div class=\"wp-block-embed__wrapper\"><iframe loading=\"lazy\"  id=\"_ytid_21155\"  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_73791\"  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><\/figure><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Php Introduction PHP is an open Source Server-side programming\/ Scripting language that suited for web development and can be embedded into HTML. PHP stands for Hypertext Preprocessor But it&#8217;s original name is Personal HomePage. it was developed in 1994. It runs in various platforms like Windows, Linux, Mac, etc. It is compatible with almost all&#8230;<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[5150],"tags":[1886,5861,5863,5866,177,5860,5858,399,5859,5865,2769],"class_list":["post-9905","post","type-post","status-publish","format-standard","hentry","category-php","tag-client","tag-computer-program","tag-how-php-works","tag-initialise-variables","tag-php","tag-php-introduction","tag-php-tutorial","tag-server","tag-tutorial-for-beginners","tag-variables-in-php","tag-web-server"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/9905","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\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=9905"}],"version-history":[{"count":40,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/9905\/revisions"}],"predecessor-version":[{"id":24974,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/9905\/revisions\/24974"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=9905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=9905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=9905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}