Skip to content

PHPCodez

Search
  • PHP
  • Magento
  • Javascript
  • HTML
  • My SQL
  • Functions
  • WordPress
  • Plugins
  • Joomla
  • Linux
  • jQuery
  • Profile
  • comments
PHP

check whether an extension is loaded – PHP

December 14, 2011 Pramod T P Leave a comment
$extensionName=”curl”;//extension name to be checked
if(!extension_loaded($extensionName)) {
echo “The extension is not loaded”;
}
FunctionsPHP
PHP

country from ip address- PHP

December 13, 2011 Pramod T P Leave a comment
We can do it using the API given below
<?php
	$country = file_get_contents("http://api.ipinfodb.com/v3/ip-country/?key=<Unique Key>&ip=$ip");
	print_r($country);
?>
APIPHP
PHP

Test if MySQL table exists – PHP

October 6, 2011 Pramod T P Leave a comment

if(mysql_num_rows( mysql_query(“SHOW TABLES LIKE ‘table_name'”)))

echo ” Table exists “

FunctionsMySQLPHP
PHP

Get the width and height of an image using a function in PHP

October 5, 2011 Pramod T P Leave a comment

list($width,$height)=getimagesize($_FILES[‘business_logo’][‘tmp_name’]);

FunctionsImagePHP
PHP

check if value present in array – PHP

September 24, 2011 Pramod T P Leave a comment
<?php
if(in_array(“val”,$array))
echo “Exists” ;
?>
ArrayFunctionsPHP
PHP

Validate a number – PHP

September 24, 2011 Pramod T P Leave a comment
if(!is_numeric($number))
echo “Not a number”;
FunctionsPHP
PHP

Validate a phone number – PHP

September 24, 2011 Pramod T P Leave a comment
if( !preg_match(“/^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$/i”, $phone_number) )
echo ‘Invalid Phone Number’;

FunctionsPHP
PHP

Number of lines in a text file – PHP

August 9, 2011 Pramod T P Leave a comment

<?php

$fp = “test.txt”;

$number = count(file($fp));

echo ” $number lines “;

?>

fileFunctionsPHP
PHP

Remove characters except letters and numbers from a string – PHP

August 9, 2011 Pramod T P Leave a comment

<?php

$var = “!P$%H^P&”;

$var1 = ereg_replace(“[^A-Za-z0-9]”, “”, $var);

echo $var1;

?>

FunctionsPHP
PHP

PHP script’s memory usage

August 9, 2011 Pramod T P Leave a comment

<?php

echo “Before the loop – “.memory_get_usage() . “<br >”;

for($i=0;$i<=100;$i++) { //echo $i;}

echo “n After the loop – “.memory_get_usage() . “n”;

?>

PHP

Posts navigation

← Previous 1 … 90 91 92 … 101 Next →

Beginners' Guide

Recent Posts

  • Upstream sent too big header while reading response
  • Navigate to a Folder from Any Location by Typing a Letter – Linux
  • Magento 2 Admin Content Deployment
  • React vs next JS
  • Disable CAPTCHA Magento 2 Admin Login
  • Difference Between composer.json and composer.lock Files
  • Magento 2 Regenerate URL Rewrites Manually For Categories
  • Magento 2 Regenerate URL Rewrites Manually for Products
  • composer self downgrade

Recent Comments

  • sunny on cgi.force_redirect
  • beats solo 4 on allow_url_include
  • Hairstyles on php end of line
  • penipu on cgi.force_redirect
  • lumi777 link alternatif on cgi.force_redirect

Categories

  • .htaccess (32)
  • Ajax (4)
  • Apache (43)
  • AWS (11)
  • Cookie (4)
  • Database Model (9)
  • Design Pattern (9)
  • Filter (27)
  • General (187)
  • HTML (5)
  • IP.Board (1)
  • Javascript (99)
  • Jetty (3)
  • Joomla (17)
  • jQuery (63)
  • JSON (3)
  • JSP (1)
  • Linux (125)
  • Magento (371)
  • My SQL (74)
  • nginx (4)
  • OOPs (12)
  • Payment Gateway (1)
  • PHP (1,005)
  • Plugins (11)
  • Prototype (1)
  • session (5)
  • Socialengine (1)
  • SQL (69)
  • SVN (17)
  • Uncategorized (11)
  • Vbulletin (11)
  • Wordpress (89)
Proudly powered by WordPress