list($width,$height)=getimagesize($_FILES[‘business_logo’][‘tmp_name’]);
Tag Archives: Functions
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();
?>
Find the total records in a mysql table – PHP
<?php
mysql_connect(“localhost”,”root”,”password”);
mysql_select_db(“store”);
$total=mysql_num_rows(mysql_query(“SELECT category_id as total FROM category”));
echo $total;
?>
mysql_connect(“localhost”,”root”,”password”);
mysql_select_db(“store”);
$total=mysql_num_rows(mysql_query(“SELECT category_id as total FROM category”));
echo $total;
?>