Info: To look into

while (list($key,$value)=each($parameters_array))

handy little bit of code I wrote to take arguments from the command line and parse them for use in my apps.


$i = implode(" ",$argv); //implode all the settings sent via clie
$e = explode("-",$i); // no lets explode it using our defined seperator ‘-’

//now lets parse the array and return the parameter name and its setting
// since the input is being sent by the user via the command line
//we will use stristr since we don’t care about case sensitivity and
//will convert them as needed later.

while (list($index,$value) = each($e)){

//lets grap the parameter name first using a double reverse string
// to get the begining of the string in the array then reverse it again
// to set it back. we will also "trim" off the "=" sign

$param = rtrim(strrev(stristr(strrev($value),’=')),"=");

//now lets get what the parameter is set to.
// again "trimming" off the = sign

$setting = ltrim(stristr($value,’='),"=");

// now do something with our results.
// let’s just echo them out so we can see that everything is working

echo "Array index is ".$index." and value is ".$value."\r\n";
echo "Parameter is ".$param." and is set to ".$setting."\r\n\r\n";



when run from the CLI this script returns the following.

[root@fedora4 ~]# php a.php -val1=one -val2=two -val3=three

Array index is 0 and value is a.php
Parameter is and is set to

Array index is 1 and value is val1=one
Parameter is val1 and is set to one

Array index is 2 and value is val2=two
Parameter is val2 and is set to two

Array index is 3 and value is val3=three
Parameter is val3 and is set to three

php Code to analyze – ini_set usage

php Code to Analyze

ini_set usage with “include_path”

if ( function_to_test($var ) ) ini_set("include_path", "/var/www/vhosts/");
else ini_set("include_path", "/var/www/vhosts/");

require "modules/mpgClasses.php";
include "modules/mpiClasses.php";

List of string functions in php

All String Functions in PHP
str_replace: How to replace a part of a string with another string
str_ireplace: Case in-sensitive search and replace using array of strings
strlen: How to find length of a string in PHP?
trim: Removing empty space from both sides of a string
strrev: Reversing a string by using strrev function in PHP
Adding two or more strings in PHP
stristr: Searching for a presence of a string inside another string
nl2br: Adding Line breaks inside a string in place of carriage returns
split: Breaking a string to form array using delimiters
substr: Collecting part of a string
substr_count: Counting occurrence of sub string in main string
str_repeat: Repeating a string number of times
strtolower(): function to change alphabets to Lower case
strtoupper(): function to change characters to upper case letters
function to collect part of a string with two landmarks
Random string generator with number and alphabets for password
strcasecmp(): Case insensitive string comparison
strcmp(): Case sensitive string comparison
str_pad(): String pad with specified length
md5 hash of a string: encryption of a string
Separating domain and userid part from an email address using split
htmlspecialchars: Printing html special chars to the page
strip_tags: Removing html tags within a string
ucwords: Converting first letter of every word to UpperCase

Disable a Hyperlink using JQuery

$('.my-link').click(function(e) { e.preventDefault(); }); 

You could use:

$('.my-link').click(function(e) { return false; });

$(".my-link").each(function() {
    $(this).attr("data-oldhref", $(this).attr("href"));

$('.my-link').bind('click', false);

And to unbind / re-enable:

$('.my-link').unbind('click', false);

JQuery: How to get value of ckecked checkbox

JQuery: How to get value of ckecked checkbox

function getCheckedId()
var allVals = [];
$(&quot;input[type='checkbox']:checked&quot;).each(function() { allVals.push($(this).val());

if( ! allVals ) return false;

len = allVals.length;

if( len == 0) return 0;

if (len &amp;gt;1) {
alert(&quot;More than one vehicle selected. Only one will be processed. &quot;);

return allVals[0];


UI Dialog Positioning

jQuery UI dialog positioning – Stack Overflow

$(&quot;.mytext&quot;).mouseover(function() {
var width = 250;
var height = 270;
var posX = $(this).offset().left – $(document).scrollLeft() – width + $(this).outerWidth();
var posY = $(this).offset().top – $(document).scrollTop() + $(this).outerHeight();
$(&quot;#dialog&quot;).dialog({width:width, height:height ,position:[posX, posY]});

JQuery Mobile Framework Connecting

JQuery Mobile Framework connecting
<link rel="stylesheet" href="mobile_css.min.css" />
<link rel="stylesheet" href="" />

<script type="text/javascript" src=""></script>

<script type="text/javascript" >
$(document).bind("mobileinit", function(){
$.mobile.ajaxEnabled = false;
<script type="text/javascript" src=""></script>

Drop shadow with CSS for all web browsers

Drop shadow with CSS for all web browsers

Very simple and effective css snippet presented below.


.shadow {
-moz-box-shadow: 3px 3px 4px #000;
-webkit-box-shadow: 3px 3px 4px #000;
box-shadow: 3px 3px 4px #000;
/* For IE 8 */
-ms-filter: &”progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color=’#000000′)&”;
/* For IE 5.5 – 7 */
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color=’#000000′);


The shadow is black (#000). If you need another color you should change the #000.

Enjoy it!