Skip to content

PHPCodez

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

Validate Email address – PHP

May 6, 2011 Pramod T P Leave a comment
if (!preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $cUrls))				$errorList[]="Invalid Client url - $cUrls. ' ";
  echo "Invalid url";
EmailPHPString functions
PHP

Validate website address – PHP

May 6, 2011 Pramod T P Leave a comment
<?php
 if (!preg_match("/^(http(s?)://|ftp://{1})
 ((w+.){1,})w{2,}$/i", $websitrAddres))
  $errorList[]="Invalid Website address. ' ";
?>
PHPString functionsURLWebsite Address
PHP

How to check whether a variable is an array – PHP

May 3, 2011 Pramod T P Leave a comment
<?php
 $array = array('this', 'is', 'an array');
 echo is_array($array) ? 'True' : 'False'; // True
 echo "  ";
 $var = 'this is a string';
 echo is_array($no) ? 'True' : 'False'; // False
?>
ArrayPHPString functions
PHP

Convert strings to an array – PHP

May 3, 2011 Pramod T P Leave a comment
<?php
 $testString = "FirstName,MiddleName,LastName";
 $testArray	 = split(",",$testString);
 print_r($testArray);
 //Array ( [0] => FirstName [1] => MiddleName [2] => LastName )
?>
<?php
 $testString = "FirstName MiddleName,LastName";
 list($first, $middle, $last) = split('[  ,]', $testString);
 echo "First Name: $first; MiddleName: $middle; LastName: $last";
?>
ArrayPHPString functions
PHP

Find out the first occurrence of a string – PHP

May 2, 2011 Pramod T P Leave a comment
<?php
 $email  = 'firstname@mail.com';
 $domain = strstr($email, '@');
 echo $domain; // prints@mail.com
?>
PHPString functions
PHP

Function to find out the substring of a string – PHP

May 2, 2011 Pramod T P Leave a comment
<?php
 echo substr('abcdef', 1, 3);
 // bcd
?>
PHPString functions
PHP

function to format the price – PHP

May 2, 2011 Pramod T P Leave a comment
<?php
 $number = 5030;
 echo number_format($number);
 // 5,030
?>
FunctionsPHP
PHP

Function to read the character from the ASCII value – PHP

May 2, 2011 Pramod T P Leave a comment
<?php
 echo chr(50).",";
 echo chr(55).",";
 echo chr(53);
?>
FunctionsPHP
PHP

Remove spaces from the end of a string – PHP

May 2, 2011 Pramod T P Leave a comment
<?php
 echo rtrim("Test  "); // Test
//Will remove the spaces from the end
?>
PHPString functions
PHP

Remove spaces from the beginning of a string – PHP

May 2, 2011 Pramod T P Leave a comment
<?php
 echo ltrim("  Test"); // Test
 //Will remove the spaces from the beginning
?>
PHPString functions

Posts navigation

← Previous 1 … 95 96 97 … 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

  • 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
  • Beauty Fashion on mysqldump create table if not exists

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