{"id":15649,"date":"2020-07-02T16:52:47","date_gmt":"2020-07-02T16:52:47","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=15649"},"modified":"2022-04-13T15:58:38","modified_gmt":"2022-04-13T15:58:38","slug":"php-7-essential-guide-php-switch-statement","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/php-7-essential-guide-php-switch-statement\/","title":{"rendered":"PHP 7 Essential Guide &#8211; PHP switch statement"},"content":{"rendered":"\n<p>In this blog I am going to explain PHP 7 Essential Guide &#8211; PHP switch statement. Switch statement is opposite to if elseif else statement which does almost the same thing. Means switch statement perform different actions based on different conditions. It check total block of code or many blocks of code and find a case statement that evaluates to true.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/ajcotocus\/8dd25817d4ffbccb7584efd3ce5737f2.js\"><\/script>\n\n\n\n<p><strong>Output-<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"606\" height=\"137\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/07\/switch-statement-1.png\" alt=\"\" class=\"wp-image-15650\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/07\/switch-statement-1.png 606w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/07\/switch-statement-1-300x68.png 300w\" sizes=\"auto, (max-width: 606px) 100vw, 606px\" \/><\/figure>\n\n\n\n<script src=\"https:\/\/gist.github.com\/ajcotocus\/e6de880a805dbaf5d7d3072857634ddd.js\"><\/script>\n\n\n\n<p><strong>Output-<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"594\" height=\"131\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/07\/switch-statement-2.png\" alt=\"\" class=\"wp-image-15651\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/07\/switch-statement-2.png 594w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2020\/07\/switch-statement-2-300x66.png 300w\" sizes=\"auto, (max-width: 594px) 100vw, 594px\" \/><\/figure>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_43756\"><iframe loading=\"lazy\"  id=\"_ytid_83661\"  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_43756\"  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>In this blog I am going to explain PHP 7 Essential Guide &#8211; PHP switch statement. Switch statement is opposite to if elseif else statement which does almost the same&#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":[6229,1122,177,6228,5828,3131],"class_list":["post-15649","post","type-post","status-publish","format-standard","hentry","category-php","tag-essential","tag-guide","tag-php","tag-php7","tag-statement","tag-switch"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/15649","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=15649"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/15649\/revisions"}],"predecessor-version":[{"id":24698,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/15649\/revisions\/24698"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=15649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=15649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=15649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}