<?php
$name = 'Zoloo';
echo $name;
echo "<strong> Hello world.</strong><br>";
$name .= ' PHP';
echo $name.'<br>';
$count = 1;
while($count<=10){
echo $count.' Hello<br>';
$count++;
}
for($count =10; $count>=1; $count--){
echo $count.'<br>';
}
$day = 'Monday';
switch($day){
case 'Saturday':
case 'Sunday':
echo 'It\'s a weekend';
break;
default:
echo 'Not a weekend';
break;
}
function MyName(){
echo 'ZBeatz';
}
function displayDate($day, $date, $year){
echo '<br>'.$day.' '.$date.' '.$year;
}
function add($num1, $num2){
$res = $num1 + $num2;
return $res;
}
echo '<br><strong>My Name is </strong><br>';
MyName();
displayDate('Monday', 31, 2011);
echo '<br>';
echo add(10, 11) + 100;
$string = 'This is an example string.';
$string_word_count = str_word_count($string);
echo '<br>'.$string_word_count;
$str_rev = strrev($string);
echo '<br>Reversed string is : '.$str_rev;
// random string;
$randstr = 'qwertyuiopasdfghjklzxcvbnm123456789';
$str_shuffled = str_shuffle($randstr);
$half = substr($str_shuffled, 0, 5);
echo '<br>'.$str_shuffled;
echo '<br>'.$half;
$string1 = 'This is my essay. I\'m going to be talking about php.';
$string2 = 'This is my essay. I will be talking about the subject php.';
similar_text($string1, $string2, $result);
echo '<br>The similarity between is : '.$result;
?>
No comments:
Post a Comment