This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class First{ | |
public function printP(){ | |
print('P is great!'); | |
} | |
} | |
class Second{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$class = "Level 1"; | |
$random = rand(0,3); | |
if($random==0) | |
{ | |
$class = "Level 2"; | |
} | |
elseif($random==1) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$class = "Level 1"; | |
$random = rand(0,3); | |
if($random==0) | |
{ | |
$class = "Level 2"; | |
} | |
elseif($random==1) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$age = 0; | |
$message0 = "At first, "; | |
$message1 = "you are age "; | |
$message2 = "After a while: "; | |
$message3 = "you die!"; | |
echo ($message0); | |
while($age<50){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$rows = [ | |
'row1' => [ | |
'color' => 'red', | |
'width' => '550px', | |
'img' => 'http://www.google.com.au/images/srpr/logo11w.png' | |
], | |
'row2' => [ | |
'color' => 'black', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getClass(){ | |
$class = "Level 1"; | |
$random = rand(0,3); | |
if($random==0) | |
{ | |
$class = "Level 2"; | |
} | |
elseif($random==1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$level=1; | |
while($level<50){ | |
$random = rand(0,3); | |
if($random==0){ | |
echo ("Level 0 message!<br/>"); | |
$level += 10; | |
} | |
elseif($random==1){ | |
echo ("Level 1 message!<br/>"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function goOn($number){ | |
for($i=0; $i < $number; $i++){ | |
$name = "Apprentice"; | |
$random = rand(0,3); | |
if($random==0) | |
{ | |
$name = "Intermediate Apprentice <br/>"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* cURL and XML parsing. | |
* | |
*/ | |
$url = "http://www.w3schools.com/xml/simple.xml"; | |
$ch = curl_init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Function to test for time overlap | |
// $start_time A start date YYYY-MM-DD HH:MM:SS | |
// $end_time An end date YYYY-MM-DD HH:MM:SS | |
// $times An array of times to match against | |
// Returns true if there is an overlap false if no overlap is found | |
function time_overlap($start_time, $end_time, $times){ | |
$ustart = strtotime($start_time); | |
$uend = strtotime($end_time); |
OlderNewer