Sunday, April 15, 2012

ITC280 Update 2

My progress at Week 2 of ITC280;


1. We can use the phpinfo() function to see what settings our clients have on their host server phpinfo();

2. We can use a variable and concatenate it with a string.
$myName = "Leopaul";
echo "My Name is " . $myName;

3. We can use variables replacement as long as we use double quotes.

$myName = "Leopaul";


echo "My Name is $myName";


4. Variable replacement using numbers
$myNum = 4;


$myOtherNum = 1;


$myTotal = $myNum + $myOtherNum;


echo "I added $myNum and $myOtherNum and the total is $myTotal";


5. Using gettype()
$myNum = 4;


echo "<br />myNum is " . gettype($myNum)." type";


6. Showing the limits of the double numeric type
$myNum = 2;


$myOtherNum = 3;


$myTotal = $myNum / $myOtherNum;


echo "I divided $myNum by $myOtherNum and the total is $myTotal";


echo "<br />myTotal is " . gettype($myTotal)." type";


7. The equals sign is the assignment operator
$myNum = 2;


$myNum = $myNum + 1;


echo "myNum is $myNum";


8. += is a compound operator that appends additional data.
$myNum = 2;


$myNum = $myNum + 1;


echo "myNum is $myNum";



9. We can increment with ++ and decrement with -
$myNum = 2;


$myNum++;


echo "myNum is $myNum";


10. How to create a dynamic copyright.
<em>&copy; 2002-<?php echo date('Y'); ?></em>

11. Short tags are bad and I will never use them but if I do...
<em>&copy; 2002-<?=date('Y')?></em>


12. Example of an if statement.
$myNum = 1;


$myOtherNum = 1;


if($myNum == $myOtherNum)


{


  echo "They are equal!";


}


13. Example of an if else statement
$myNum = 2;


$myOtherNum = 1;


if($myNum == $myOtherNum)


{


  echo "They are equal!";


}else{


  echo "They are NOT equal!"; 


}


14. Constants once filled cannot be changed and are constantly available.
define("MY_PAY" ,35000);


if($myPay >= 110000)


{


  echo "I'm happy!"; 


}else if(MY_PAY >= 85000){


 echo "I'm marginally happy!";  


}else{


  echo "Not so happy!"; 


}





15. We can create a function to store code we want to reuse.
function areYouHappy()

{





 if(MY_PAY >= 110000)


 {


   echo "I'm happy!"; 


 }else if(MY_PAY >= 85000){


  echo "I'm marginally happy!";  


 }else{


   echo "Not so happy!"; 


 }


   


}//end areYouHAppy()


* Pop Quiz # 2 score; 7/10 (67%)

* Test # 2 score: 72/100 (72%)

* Time spent total: 5 hours 11 minutes

NOTES: Back in Wednesday, at the near end of the ITC280 class, we did the Assignment # 2, which involves on cutting up two existing third party HTML designs into include files to create two different usuable and professional looking PHP templates. On class, we did just one out of two, but it's a bit more complicating. Happily, however, Mr. Bill Newman, our teacher, will help us do another one on Monday.

That is all... Thank You...


1 comment:

Bill said...

Leopaul,

I'm doing some grading for class exercises week 2. All looks good!

Be sure to update your time tracker to reflect time spent.

You probably don't need to paste your exercise code into your blog, as it exists in your class exercises already.

Have a great Sunday!

Bill