This site is an assignment site for study group of Hello World forum.
Together we are studying the book Larry Ullman PHP For World Wide Web.

Chapter 1: Getting Started With PHP


Working with XAMMP in Mac OS X 10.5 (Leopard)

My coal is to test PHP sites on my own computer before sending them to remote server. My remote server is going to be my son's server and it's using PHP 5. Setting up my local and testing server was first a bit complicated.

I first tried MAMP, which was easy to install, but somehow difficult to use and modify the settings. Then I found a good instructions how you do that in Mac OS X 10.5 (Leopard) ( Apache and PHP comes with Leopard).

That works fine, but saw KC using XAMMP and wanted to try it. So I installed XAMMP and started it just clicking XAMPP Control Panel.app's icon, without using terminal (even the instructions in XAMMP's site pointed to use terminal) and everything is working just fine now. Yes and I got also Dreamweaver settings working right.

To use echo or print Hmmm...

In these next two sentence the first one is created using PHP command print
and the next echo

<?php print ("Hello world!");?> Hello, world!
<?php echo "Hello world!";?> Hello, world!

Both do the same job, so it usually comes down to a matter of personal choise on which one you like to use.

Echo does not give you a return value. print() does. echo accepts several arguments. print() one.

Hello, world! This is print statement

Hello, world! This is echo statement

Echo is faster than print. There is a lot of discussion about
echo vs. print. Read More.

I think I choose echo. I have used to use it and it's shoter to type , hmm ... I choose echo.

Commenting code

This is HTML comment <--comment-->

<?php

//This is a single line comment

#Or you may mark it like this

/*This is multiline comment.

It needs also

ending mark*/

?>

The Source Code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="author" content="Kristiina Hillerström" />
<meta name="Description" content="An assingment site of studygroup Hello World PHP 101." />
<title>PHP for World Wide Web</title>
<link href="css/phpwww.css" rel="stylesheet" type="text/css" />
<!--[if IE]>
<style type="text/css"> 
.mybuggyelement { zoom: 1;}
</style>
<![endif]-->
</head>
<body >
<div id="container">
  <!-- start #container -->
  <div id="header"> <img src="images/pw_header.jpg" width="780" height="61" alt="header" />
    <h1>PHP for World Wide Web</h1>
    <!-- end #header -->
  </div>
  <!-- start navi  --><div id="navcontainer">
<ul id="navlist">
<li><a href="index.php">Index</a></li>
<?php //for-lop to print menu usind div and list
         
    
for ($i 1$i <= 13$i++) {
        echo 
"<li><a href='ch$i.php'>Ch$i</a></li>";
    }
     
?>
<li><a href="../index.en.html">Home</a></li>
</ul>
</div>
  <!-- end navi  -->
  <!-- start #mainContent -->
  <div id="mainContent">
    <p class="tittle">This site is an assignment site for study group of 
    <a href="http://lzydaz.com/phpBB3/index.php?sid=71b334691616fb09a7fae8b7a2c2f477"> Hello World</a> forum.<br />
  Together we are studying the book <a href="http://www.dmcinsights.com/phpvqs2/"> Larry Ullman PHP For World Wide Web.</a></p>
    <h4 class="tittle">Chapter 1: Getting Started With PHP</h4>
    <ul>
      <li>Basic XHTML Syntax</li>
      <li>Basic PHP Syntax</li>
      <li>Testing Your Script</li>
      <li>Sending Text to the Browser</li>
      <li>Sending HTML to the Browser</li>
      <li>Using White Space in PHP and HTML</li>
      <li>Adding Comments to Your Scripts</li>
    </ul>
    <h2><a href="http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/"><br />
      </a>Working with XAMMP in Mac OS X 10.5 (Leopard)</h2>
    <p>My coal is to test PHP sites on my own computer before sending them to remote server.
My remote server is going to be my son's server and it's using PHP 5. Setting up my local and testing server
 was first a bit complicated.</p>
    <p> I first tried <a href="http://www.mamp.info/en/index.php">MAMP</a>, which was easy to install,
     but somehow difficult to use and modify the settings. Then I found a good instructions how you do that in
      <a href="&lt;a href=&quot;http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/&quot;&gt;">
      Mac OS X 10.5 (Leopard)</a> ( Apache and PHP comes with Leopard). </p>
    <p>That works fine, but saw KC using <a href="http://www.apachefriends.org/en/xampp-windows.html">XAMMP</a>
     and wanted to try it. So I installed <a href="http://www.apachefriends.org/en/xampp-macosx.html">XAMMP</a>
      and started it just clicking XAMPP Control Panel.app's icon, without using terminal  
      (even the instructions in <a href="http://www.apachefriends.org/en/xampp-macosx.html">XAMMP</a>'s site pointed to use terminal)
       and everything is working just fine now. Yes and I got also Dreamweaver settings working right.</p>
    
    <?php
print "<h2>To use <span>echo</span> or <span> print</span> Hmmm...</h2>";
echo 
"<p>In these next two sentence the first one is created using PHP command<span> print </span><br />
and the next<span> echo </span></p>"
;
highlight_string('<?php print ("Hello world!");?>');
print (
"Hello, world!");// PHP statement with () marks.
echo "<br />";
highlight_string('<?php echo "Hello world!";?>');
echo 
"Hello, world!";// It's not nessery to use () marks.
print"<p>Both do the same job, so it usually comes down to a matter of personal choise on which one you like to use. </p>";
echo 
"<p>Echo does not give you a return value. print() does. echo accepts several arguments. print() one.</p>";
print 
"<h2>Hello, world! This is <span>print</span> statement</h2>";
echo 
"<h2>Hello, world! This is <span>echo</span> statement</h2>\n";
// using (\n) for making newlines simplify the look of sourse code.
//print    (    "echo"    );//spacing out functions will also simplify the look of sourse code.
//echo("print");//still the meaning dosn't change.
echo "<p>Echo is faster than print. There is a lot of discussion about <br />
<a href=\"http://www.webdevnotes.com/echo-vs-print-which-should-be-used/\">echo vs. print. Read More.</a></p>"
;
echo 
"<p>I think I choose echo. I have used to use it and it's shoter to type , hmm ... I choose echo.</p>";
print 
"<h2>Commenting code </h2>";
?>
    <?php
echo "<p>This is HTML comment <span>&lt;--comment--&gt;</span></p>";
print 
"<p class='phpkoodi'> &lt;?php </p>";//Remember single quotation marks inside string 
echo "<p class=\"orange\">    //This is a single line comment</p>";
//Escape quotation marks that are within the string by placing a slash directly before the quotation mark, i.e. \"
print '<p class="orange">  #Or you may mark it like this</p>';// Single quotation marks outside
echo'<p class="orange">  /*This is multiline comment.</p>';
print 
'<p class="orange">It needs also </p>';
echo 
'<p class="orange">    ending mark*/</p>';
echo 
'<p class="phpkoodi"> ?&gt;</p>';
?>

    
    <!-- end #mainContent -->
  </div>

  <!--start koodi-->
  <div id="koodi">
  <h2>The Source Code </h2>
<?php
show_source
(basename($_SERVER['PHP_SELF'])); //shows the source code of this page
?>
</div> <!--end koodi-->
  <!-- start #footer -->
  <div id="footer">
    <p>&copy; K.Hillerstr&ouml;m 2009 <a href="http://validator.w3.org/check?uri=referer"> 
    <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /> 
    </a> <a href="http://jigsaw.w3.org/css-validator/check?uri=referer"> 
    <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" height="31" width="88"/> </a>Last Updated
      <!-- #BeginDate format:Ge1m -->03.04.2009  23:38<!-- #EndDate -->
    </p>
    <!-- end #footer -->
  </div>
<!-- end #container --></div>
</body>
</html>