<a href=”javascript:window.print()”>Print</a>
Tag Archives: Functions
Get the width and height of an image using a function in PHP
list($width,$height)=getimagesize($_FILES[‘business_logo’][‘tmp_name’]);
javascript load a url in new tab
javascript:window.open(‘www.example.oom’,’_blank’)
check if value present in array – PHP
<?php
if(in_array(“val”,$array))
echo “Exists” ;
?>
if(in_array(“val”,$array))
echo “Exists” ;
?>
Validate a number – PHP
if(!is_numeric($number))
echo “Not a number”;
echo “Not a number”;
Validate a phone number – PHP
if( !preg_match(“/^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$/i”, $phone_number) )
echo ‘Invalid Phone Number’;
echo ‘Invalid Phone Number’;
Number of lines in a text file – PHP
<?php
$fp = “test.txt”;
$number = count(file($fp));
echo ” $number lines “;
?>
Remove characters except letters and numbers from a string – PHP
<?php
$var = “!P$%H^P&”;
$var1 = ereg_replace(“[^A-Za-z0-9]”, “”, $var);
echo $var1;
?>
Function to get last Java exception – PHP
<?php
java_last_exception_get();
?>
Function to clear last Java exception – PHP
<?php
java_last_exception_clear();
?>