<?php
echo sqrt(4); // 2
echo sqrt(12); // 3.4641016151378
echo sqrt(16); // 4
echo sqrt(17); // 4.1231056256177
?>
Get Free Sinhala IT Learning Videos Kuppiya.com
<?php
echo sqrt(4); // 2
echo sqrt(12); // 3.4641016151378
echo sqrt(16); // 4
echo sqrt(17); // 4.1231056256177
?>
<?php
echo round(10.8); // 11
echo '<br />';
echo round(10.4); // 10
echo '<br />';
/*you can also set the number of precision,
or in other words number of decimal digits
you like to round the floating number
*/
echo round(10.837, 2); // 10.84
echo '<br />';
echo round(10.435767, 4); // 10.4358
echo '<br />';
?>
<head>
<script type="text/javascript">
var my_string = "Hello My Name Is Kusal";
var split_var = my_string.split(" "); //separate by space
alert(split_var[0]); //Hello
alert(split_var[1]); //My
alert(split_var[4]); //Kusal
</script>
</head>
<body>
<select name="colors">
<option>Select</option>
<option style="background-color:rgb(200,250,300);">Color 1</option>
<option style="background-color:rgb(100,89,200);">Color 2</option>
<option style="background-color:rgb(65,89,50);">Color 2</option>
</select>
<br /><br />
<div style="background-color:rgb(200,100,100);">Hello</div>
</body>
<?php
$dir_path = 'kusal/test'; //directory path
$list_files = scandir($dir_path);
//dumping the array
//hope you know how to access an array
echo '<pre>'; //html <pre> tags will format the output
print_r($list_files);
echo '</pre>';
/*
Output look like this
Array
(
[0] => .
[1] => ..
[2] => TextDocument.txt
[3] => kuppiya.doc
[4] => lion.ppt
[5] => test.as
)
*/
?>
<?php
$path = 'path to directory'
//First Check if deleting a directory
if(is_dir($path))
{
//remove directory
if(rmdir($path))
{
echo 'Deleted';
}
else
{
echo 'error';
}
}
else
{
echo 'Not a directory';
}
?>
<html>
<head>
<script type="text/javascript">
function chng_color()
{
document.getElementById('my_div').style.color = 'red';
}
function normal_color()
{
document.getElementById('my_div').style.color = 'black';
}
</script>
</head>
<body>
<div id="my_div" onmouseover="chng_color()" onMouseOut="normal_color()">
This is the first example!!!
</div>
</body>
</html>
<html>
<head>
<script type="text/javascript">
function alrt_text()
{
var entered_text = document.getElementById('my_text_box').value;
alert(entered_text);
}
</script>
</head>
<body>
Your Text:
<input type="text" name="my_text_box" id="my_text_box" onBlur="alrt_text()" />
</body>
</html>