| 0 comments ]

####################################################
function to get the extenstion of a file
####################################################


function getFilenameExtension($fname){
$extension = explode('.', $fname);
//returning the extension of the files
return $extension[sizeof($extension)-1];
}

?>
#####################################################
Example
#####################################################

echo getFilenameExtension("filedbconection.inc.php");

?>
######################################################
Answer :php
######################################################

| 0 comments ]

//wrapping the text by 10 charecters
function displayWordWrap($text,$size=10){
$newtext = wordwrap($text, $size, " ", true);
return $newtext;
}

| 0 comments ]

//function to check whether the url isvalid or not

function validUrl($url)
{
if(preg_match("/^((http:|https:)\/\/)[A_Za-z0-9_]*(\.)[a-zA-Z]*[?|&|[a-zA-Z0-9]]*/",$url))
return 1;
else
return 0;
}

| 0 comments ]

/* Displaying the tagclouds

function displayTagCloud($tags) {
// $tags is the array
//sorting the tags array
arsort($tags);

// looping through the tag array
foreach ($tags as $key => $value) {
$size=rand(15,25);
$value1="'".$value."'";
echo "<a href="http://www.php.qa.blogspot.com%27" style="" title="'" >".$value."</a > ";
}
}

| 0 comments ]

############################################################################
A function to ckeck the password length


function checkpassword_length($pass){
$len=strlen($pass);
if($len>=6 && $len<16){
return false;
}else{
return true;
}
}

| 0 comments ]

<body>
<head><TITLE>Test HTML DOM and JavaScript</TITLE>
<script language="javascript" type="text/javascript">
function addNewTexrFields() {
var ni = document.getElementById('testDiv');
var count = ni.childNodes.length;
if(count<4){
count=count+1;
var p = "addDiv"+i;

var testA = document.createElement('div');
testA.setAttribute('id',p);
testA.setAttribute('align','left');

var testTxt = document.createElement('input');
testTxt.setAttribute('type','text');
testTxt.setAttribute('name','test[]');
testTxt.setAttribute('size','40');

testA.appendChild(testTxt);
ni.appendChild(testA);
}
}
</script>
</head>
<body>
<table>
<tr>
<td align="left" width="40%">
text fields
</td>
<td align="left" width="60%">
<input type="text" size="40" name="test[]"> <a href="javascript:addNewTexrFields()">Add More</a>
<div align="left" id="testDiv"></div>
</td>
</tr>
</table>
</body>
</html>


just try it .........