Skip to content

PHPCodez

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

Monthly Archives: April 2011

Wordpress

How to get the theme url – WordPress

April 19, 2011 Pramod T P Leave a comment
<?php
  bloginfo('stylesheet_directory');
 // Theme path
?>
BloginfoPHPWordpress
PHP

Remove spaces from the beginning and end of a string – PHP

April 19, 2011 Pramod T P Leave a comment
<?php

echo trim("  Test "); // Test

//Will remove the spaces from the beginning and end
?>
PHPString functions
Wordpress

Function that displays the categories – WordPress

April 19, 2011 Pramod T P Leave a comment
<?php
 wp_list_categories();
 // List all categories
?>
CategoryPHPWordpress
PHP

How to read all the keys or a subset of the keys of an array – PHP

April 19, 2011 Pramod T P Leave a comment
<?php
 $testArray = array(1 => 5, "name" => "First Name");
 print_r(array_keys($testArray));
 //Array ( [0] => 1 [1] => name )
?>
ArrayPHPString functions
PHP

Check whether a variable is empty – PHP

April 19, 2011 Pramod T P Leave a comment
<?php
 // Example 1
 $string="";
 if(empty($string))
  echo "Empty string";
 else
  echo "Not an empty string"; //Empty string
?>

<?php
 // Example 2
 $strng="Test";
 if(empty($strng))
  echo "Empty string";
 else
  echo "Not an empty string";  //Not an empty string
?>
PHPString functions
PHP

Add backslashes in front of special characters – PHP

April 19, 2011 Pramod T P Leave a comment
<?php
 $str = "Test's";
 echo addslashes($str); //Test's
?>
PHPString functions
PHP

Removes backslashes – PHP

April 19, 2011 Pramod T P Leave a comment
<?php
 $str = "Test's";
 echo stripslashes($str); //Test's
?>
PHPString functions
PHP

Converts characters to HTML entities – PHP

April 19, 2011 Pramod T P Leave a comment
<?php
 $str = "<p>First Name</p>";
 echo htmlentities($str); //<p>First Name</p>
?>
PHPString functions
PHP

Randomizes the order of the elements in an array – PHP

April 19, 2011 Pramod T P Leave a comment
$numbers = range(0, 9);
shuffle($numbers);
foreach ($numbers as $number) {
 echo $number;
}
ArrayPHPString functions
PHP

Create an array containing a range of elements – PHP

April 19, 2011 Pramod T P Leave a comment
<?php
 $numbers = range(0, 9);
 foreach($numbers as $value)
   echo $value." ";
//Will output  0 1 2 3 4 5 6 7 8  9
?>
ArrayPHPString functions

Posts navigation

← Previous 1 … 6 7 8 … 11 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