{"id":7328,"date":"2019-10-21T07:48:36","date_gmt":"2019-10-21T07:48:36","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=7328"},"modified":"2022-05-08T12:07:23","modified_gmt":"2022-05-08T12:07:23","slug":"beginner-guide-of-php-strings","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/beginner-guide-of-php-strings\/","title":{"rendered":"Beginner guide of PHP Strings"},"content":{"rendered":"\n<p>A string is arrangement of characters, where a character is equivalent to a byte. This implies PHP just supports a 256-character set, and subsequently doesn&#8217;t offer local Unicode support. <\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>String has four different ways written as :- <\/strong><\/p>\n\n\n\n<p>1.) Single quoted (\/)<br> 2.) Double quoted (&#8220;)<br> 3.) Heredoc Syntax (&lt;&lt;&lt;)<br> 4.) Nowdoc syntax  (&lt;&lt;&lt;)<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>1.)Single quoted  (\/):-<\/strong><\/p>\n\n\n\n<p>Single quoted strings are the most straightforward approach to indicate string. Single quote is utilized to indicate string when we need the string to be actually as it is composed.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Bitbuckettraining\/ac67d8ede05de3831e06eba6039739f3.js\"><\/script>\n\n\n\n<p class=\"has-medium-font-size\"><strong>2.)Double quote (&#8220;):-<\/strong><\/p>\n\n\n\n<p>Double quote strings  will show a large group of got away characters , and variables in the strings will be assessed. A significant point here is that you can use curly braces to isolate the name of the variable you want evaluated.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Bitbuckettraining\/6bbf45d2ece5b4b28ab4747f2707f411.js\"><\/script>\n\n\n\n<p class=\"has-medium-font-size\"><strong>3.)heredoc (&lt;&lt;&lt;):-<\/strong><\/p>\n\n\n\n<p>Heredoc for multi-line strings that require formatting and variable interpolation.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Bitbuckettraining\/b2e5b6c2ef47f6f030458fb8b688d3b5.js\"><\/script>\n\n\n\n<p class=\"has-medium-font-size\"><strong>4.) Nowdoc syntax (&lt;&lt;&lt;):-<\/strong><\/p>\n\n\n\n<p>Nowdocs are to single-quoted strings what heredocs are to twofold quoted strings. A nowdoc is indicated similarly to a heredoc, yet no parsing is done inside a nowdoc. The develop is perfect for implanting PHP code or other huge squares of content without the requirement for getting away. It imparts a few highlights in like manner to the SGML  build, in that it announces a square of content which isn&#8217;t for parsing. It symbol similar to heredoc but identifier which follows is inclosed.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Bitbuckettraining\/4e5c73dd4a0e7890071f1c0d545d34ff.js\"><\/script>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Print function:-<\/strong><\/p>\n\n\n\n<p>Utilizing this function we can show the outputs in the program. This capacity restores the Boolean worth genuine. We can&#8217;t print the different articulations utilizing this capacity. The print capacity assumes a similar job as the echo function.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Bitbuckettraining\/d326e2d1aca081fe8914523c814cd798.js\"><\/script>\n\n\n\n<p class=\"has-medium-font-size\"><strong>String functions:- <\/strong><\/p>\n\n\n\n<p><strong>strtolower, strtoupper, strlen, strpos,<br> str_replace, substr, str_split<\/strong><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Strtolower:- <\/strong><\/p>\n\n\n\n<p>Strtolower() is a function that can be used to convert to use lowercase string. strtolower function takes string as parameter and converts all the uppercase english alphabets persent in the string to lowercase. All numeric characters or all special characters in string renames that unchanged.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Bitbuckettraining\/af1cb3345b70b321a41e5fb5d0477fb2.js\"><\/script>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Strtoupper:-<\/strong><\/p>\n\n\n\n<p>Strtoupper() is a function tha can be used to convert to use uppercase string. Strtoupper function takes string as parameter and converts all the lowercase english alphabets persent in the string to upercase. All numeric characters or all special characters in string renames that unchanged. <\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Bitbuckettraining\/cf47f5fa0c9a0c50dd493cfbed402199.js\"><\/script>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Strlen:-<\/strong><\/p>\n\n\n\n<p>Strlen() is a function in PHP  which returns given string  lenth. Strlen takes a string returns its lenght as a parameter. It calculates string of length.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Bitbuckettraining\/356491dd66188f50b8d2b1f8b59327cc.js\"><\/script>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Strpos:-<\/strong><\/p>\n\n\n\n<p>Strpos() in this function in PHP returns a value Zero(0). which is in this given string.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>str_replace:-<\/strong><\/p>\n\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_45347\"><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_70503\"  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_45347\"  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>A string is arrangement of characters, where a character is equivalent to a byte. This implies PHP just supports a 256-character set, and subsequently doesn&#8217;t offer local Unicode support. String has four different ways written as :- 1.) Single quoted (\/) 2.) Double quoted (&#8220;) 3.) Heredoc Syntax (&lt;&lt;&lt;) 4.) Nowdoc syntax (&lt;&lt;&lt;) 1.)Single quoted&#8230;<\/p>\n","protected":false},"author":1,"featured_media":7444,"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":[1243,1122,177,5444],"class_list":["post-7328","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-beginner","tag-guide","tag-php","tag-strings"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/7328","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=7328"}],"version-history":[{"count":4,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/7328\/revisions"}],"predecessor-version":[{"id":25356,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/7328\/revisions\/25356"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/7444"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=7328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=7328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=7328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}