Fahdi’s Personal Blog

Here I share my web ideas

PHP: How to rewmove last comma from a string

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
November25

Hello readers

A few minutes ago, I had a situation where

For example you have a string which is like “cat,cow,hamster,owl,”

and you want to remove the last comma from the string

then you can use this code

<?php
$string="cat,cow,hamster,owl,";
echo $string."<br/>";
$string= substr($string, 0, strlen($string)-1);
echo $string;
?>

This comes really handy in many situations.

Share and Enjoy:
  • Digg
  • Facebook
  • LinkedIn
  • NewsVine
  • Technorati
  • Sphinn
  • del.icio.us
  • Mixx
  • Google
  • StumbleUpon
  • Live
  • Print this article!
  • feedmelinks
  • E-mail this story to a friend!
  • Reddit
posted under PHP Tips | No Comments »%RATINGS_IMAGES_VOTE%

Ajax loading button/ bar/ icon gif animation maker/generator with configurable background and foreground color

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...
December10

You are a web surfer right? Thats how you stumbled upon my site. You can rate this post by clicking on these rating stars with this post and yeah you see that cool when you rate a post here. Its an Ajax script working on the background showing you the nice status bar message with this icon. Its interactive and a good usable thing for your own Ajax script. Wanna make one like that for your ajax stuff? Yeah you can do so on the web!

Ajax loading gif generator Create easily your own ajax loader icon

Keep on reading to find the link to the amazing site! Read the rest of this entry »

Share and Enjoy:
  • Digg
  • Facebook
  • LinkedIn
  • NewsVine
  • Technorati
  • Sphinn
  • del.icio.us
  • Mixx
  • Google
  • StumbleUpon
  • Live
  • Print this article!
  • feedmelinks
  • E-mail this story to a friend!
  • Reddit

PHP: for loop or foreach loop with mutiple arrays. Multiple arrays in a single foreach loop

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
December6

Here is an example for toy to understand the concept of multiple arrays in a single loop in PHP. My friend and coworker Mohammad Khan (yeah he is from Peshawar and sits beside me in the office where we develop web applications) was working on a such a situation for an airline scheduling system for Intercontinental Airways with HTML form submission in PHP where he has multiple arrays passed as POST variables. So I did a quick search on internet and found solutions spread across the forums. I decided to do the quick and dirty mash up of all the stuff with proper editing to get you guys going on the same path along! Read the rest of this entry »

Share and Enjoy:
  • Digg
  • Facebook
  • LinkedIn
  • NewsVine
  • Technorati
  • Sphinn
  • del.icio.us
  • Mixx
  • Google
  • StumbleUpon
  • Live
  • Print this article!
  • feedmelinks
  • E-mail this story to a friend!
  • Reddit
posted under Open Source, PHP, PHP Tips, Web Development | No Comments »%RATINGS_IMAGES_VOTE%