User Tools

Site Tools


php_first_lesson

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
php_first_lesson [2024/10/04 07:07] appledogphp_first_lesson [2024/10/04 07:10] (current) appledog
Line 5: Line 5:
 A big question could be, "Why PHP?" Well, PHP has an easy syntax and is extremely useful for web-based programming. It's a great starter, with better syntax than Python. And, why not? PHP has it's own local server, so it's easy for anyone to use. You can just use a text editor. Its oldschool! A great start for the serious. And so, we began. A big question could be, "Why PHP?" Well, PHP has an easy syntax and is extremely useful for web-based programming. It's a great starter, with better syntax than Python. And, why not? PHP has it's own local server, so it's easy for anyone to use. You can just use a text editor. Its oldschool! A great start for the serious. And so, we began.
  
-== 1. Hello World+== 1. Hello World with echo()
 Run this. What does it do? What is ECHO? Run this. What does it do? What is ECHO?
  
Line 95: Line 95:
 </Code> </Code>
  
-== IF+== 2. input with readLine() 
 +Teacher and Doctor. Here is teacher.php: 
 +<Code:PHP> 
 +<?php 
 + 
 + $name = readLine("What is your name? "); 
 + echo "Hello {$name}!\n"; 
 + echo "Your new name is Teacher {$name}.\n"; 
 +?> 
 +</code> 
 + 
 +and doctor.php: 
 +<Code:PHP> 
 +<?php 
 + 
 + $name = readLine("What is your name? "); 
 + echo "Hello {$name}!\n"; 
 + echo "Your new name is Dr. {$name}.\n"; 
 +?> 
 +</Code> 
 + 
 +== 3. decision making with if-then
 <Code:PHP> <Code:PHP>
 <?php <?php
php_first_lesson.1728025634.txt.gz · Last modified: 2024/10/04 07:07 by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki