Use here doc in php…

Hello Friends, how are you?

I am showing now, how to use “here doc” in php? So, consider the below code-

 

<?php

//here is two variable

$username=”tisuchi”;

$password=”1234”;

 

//here doc is starting…

echo <<< my_login_start()

User Name: $username

Password: $password

my_login_start();

?>

 

Explain:

First I take two variable $username and $password. Then I make a echo statement, here I use a function (like variable) my_login_start(). Then I print User Name and Password accordingly variable $username & $passsword and finally I close my_login_start();. Now, It is ok.

 

 

Output:

User Name: tisuchi

Password: 1234

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s