Jump to content

Stiil a PHP Newbi


Mr_J

Recommended Posts

Hi all

I’m new to PHP. I got myself a book, SAMS TEACH YOURSELF PHP IN 10 MINUTES.

a Very simple project just to learn: I made a page in php to display the time and date. To go 1 step further, I added some HTML between the codes. When the page is loaded, everything is there except it made 2 extra lines witch I gave no command to do so...  ???

This is my code... It is the bottom part from <HTML> as I’m still fooling around with bad code, " vs ', stop statements and comments etc.

 

<?php        /*

The time is

// lesson 1.1

echo date('H|i|s');?>

and the date is

<?php echo date('j F Y');?>

<?php /* die bg wys die tyd en datum sonder

enige spasies...

?>

<?php

// lesson 1.2

echo "The Time Is ";

echo date('H:i:s');

echo " The Date Is ";

echo date ('j F Y');

// Hierdie het `n spasie tussen die tyd en text van die datum gemaak...

            */ ?>

 

<?php

// lesson 1.3 BADLY Formatted script ?>

 

<?php /*echo "The time is "; echo date('H:i:s'); echo

" and the date is "

; echo date(

'j F Y'

);    // New line in browser: [ \n ]  nog `n ignore statement: [ # ]

*/?>

 

<?php  # lesson 1.4 is om "comments" in jou script te gebruik...

/* time.php [naam van file]

tussen die volgende sal als ge-ignore word deur php /* en */

?>

<html>

<title>PHP in 10 Minutes</title>

<body>

<p><h2><li>Les </h2><h1>1</h1> <h2>gaan oor ECHO "</h2></li></p>

<?php

echo "The time is ";

echo date("H:i:s"); //Hours, minutes, seconds

 

echo " The date is ";

echo date("j F Y"); //Dag naam, maand naam en jaar * let op die spasie voor en na " in die text

?>

<p><h2><strong>Einde van LESSON 1!</strong></h2></p>

</body>

</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.