{"id":273,"date":"2018-01-04T09:38:55","date_gmt":"2018-01-04T09:38:55","guid":{"rendered":"http:\/\/mddir.com\/how-to\/?p=273"},"modified":"2018-01-04T09:38:55","modified_gmt":"2018-01-04T09:38:55","slug":"run-two-variables-in-echo-statement","status":"publish","type":"post","link":"https:\/\/www.mddir.com\/how-to\/run-two-variables-in-echo-statement\/","title":{"rendered":"Run two variables in echo statement"},"content":{"rendered":"<p>You can run the two variables in echo statement by declaring the concatenation tag. <\/p>\n<p>Here is the example:<\/p>\n<p>[php]&lt;?php<br \/>\n    $name=&quot;John&quot;;<br \/>\n    $lastName=&quot;Graham&quot;;<br \/>\n    echo $name.&quot; &quot;.$lastName; \/\/ Outputs John Grahem<br \/>\n?&gt;[\/php]<\/p>\n<p>Let&#8217;s break down the code to understand each element.<\/p>\n<p>1) We have created the simple php code by using variable &#8220;<code>$name<\/code>&#8221; &#038; &#8220;<code>$lastName<\/code>&#8221; to assign the string value &#8220;<code>John<\/code>&#8221; &#038; &#8220;<code>Graham<\/code>&#8221; respectively.  <\/p>\n<p>[php]&lt;?php<br \/>\n$name=&quot;John&quot;;<br \/>\n $lastName=&quot;Graham&quot;;<br \/>\n?&gt;[\/php]<\/p>\n<p>2) Now we run the code by declaring the concatenation tag in the echo statement.<\/p>\n<p>[php]&lt;?php<br \/>\n    $name=&quot;John&quot;;<br \/>\n    $lastName=&quot;Graham&quot;;<br \/>\n    echo $name.&quot; &quot;.$lastName; \/\/ Outputs John Graham<br \/>\n?&gt;[\/php]<\/p>\n<p>3) The concatenation tag looks like this. <\/p>\n<p>[php].&quot; &quot;.[\/php]<\/p>\n<p>By declaring the concatenation tag you can separate the two variables. <\/p>\n<p>4) The php code will run smoothly once you add concatenation tag in between the variables and execute the code.<\/p>\n<p>The above code will give output.<\/p>\n<p>John Graham<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can run the two variables in echo statement by declaring the concatenation tag. Here is the example: [php]&lt;?php $name=&quot;John&quot;; $lastName=&quot;Graham&quot;; echo $name.&quot; &quot;.$lastName; \/\/<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-273","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/posts\/273","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/comments?post=273"}],"version-history":[{"count":1,"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/posts\/273\/revisions"}],"predecessor-version":[{"id":274,"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/posts\/273\/revisions\/274"}],"wp:attachment":[{"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/media?parent=273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/categories?post=273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mddir.com\/how-to\/wp-json\/wp\/v2\/tags?post=273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}