Professional Documents
Culture Documents
<?
$string = "hello world";
$length = strlen($string);
//count no of words
<?php
$string = "hello, world! this is a sample string";
// maths functions
<?php
$num1= 10;
$num2= 5;
//addition
$sum= $num1 +$sum2;
echo "sum:" .$sum ."\n";
//Substraction
$sub = $num1 - $num2;
echo "substraction:" .$sub ."\n";
//Multiplication
$mul = $num1 * $num2;
echo "Product:" $mul ."\n";
//Division
$division = $num1 / $num2;
echo"Quotient:" $division ."\n";
//Power
$power = pow($num1,$num2);
echo "Power:" $power .'\n";
//Square root
$sqrt = sqrt($num1);
echo "square root;" .$sqrt ."\n";
?>
//parameterize
<?php
//call the function with arguments and store the result in variable
$result = calculateSum (10,5);
//