Jump to content

PLease explain this small code to me.


KDM

Recommended Posts

     $head .= ' 		
			  <form method="post" method="index2.php">
	  			<div style="margin-bottom:10px; margin-top:20px; color:#FFFFFF">login
				    <br />
	  			  <input class="inputfields" type="text" name="username" />
	  			</div>
	  			<div style="margin-bottom:10px; color:#FFFFFF">
              password
	  				<input class="inputfields" type="password" name="pwd" />
	  			</div>
	  			<div><input type="submit" name="login" value="Login" /></div>
	  		</form>';
		}
	  $head .= $msg;	
    $head .= '</div>';

 

$head .= '

These are all throughout my site. What does it mean? When I try to add a div I can't. What's the purpose of placing a div into the site by using $head.? 

Link to comment
https://forums.phpfreaks.com/topic/239114-please-explain-this-small-code-to-me/
Share on other sites

Um, this is kind of a broad question. The exact point of this code is unclear, as we never see what is done with the $head variable.

 

However, what the code is doing is pretty easy to explain.

 

first things first, this

.=

 

this is a compound operator, like += or -=, which basically means this

$head .= "some string";
//the above is the same as
$head = $head . "some string";

 

recall that the period (.) operator in PHP is the concatenation operator. Concatenation is basically adding two strings together.

 

Now, the point of your code seems to be concatenating some HTML together. WHat happens to this html is unclear as you havent posted what your code does with $head

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.