• t
  • g
  • B
  • Z
  • @
  • e

portfolio & blog of senior web developer, Fahd Murtaza



  • About
  • Portfolio
  • WordPress
  • CV
  • Blog
  • Contact


  • About
  • Portfolio
  • WordPress
  • CV
  • Blog
  • Contact

PHP: Removing last instance of a character within text using Regex

August 28th, 2011 by Fahd

I recently encountered a situation where I needed to remove the last instance of the character ‘|’ in the menu that was being dynamically generated. So I came up with the following code

<?
$menu = 'I AM |NOT| A BAD |BOY|';
$menu = preg_replace('/[|]([^|]*$)/', '$2', $menu);
echo $menu."\n";
?>

The output would be

I AM |NOT| A BAD |BOY

And that removes the last instance of a character (in this case a pipe sign, i.e ‘|’ ). Hope that helps others.

Posted in PHP

3 Comments

PHP: Text cropping with defining the number of characters, words or sentences

March 18th, 2009 by Fahd

I have recently been working on PHP RSS reader script that was supposed to do three different things with RSS description text. To make a teaser RSS text, I was asked to develop the functionality in a such a way that text can be cropped in these three ways.

  • with defining the number of words.
  • with defining the numbers of characters.
  • with defining the number of sentences.

Here is a set of functions that helps you crop a text in three different ways. The usage of the function is also mentioned at the end f the script. (more…)

Posted in PHP, PHP Tips, Web Development

5 Comments

How to make sure your PHP RSS feed reader doesn’t mess up

March 18th, 2009 by Fahd

I was recently working on a custom RSS feed reader where the prior most concern of the client was being able to crop the text with respect to the

  1. Number of words.
  2. Numbers of characters.
  3. Number of sentences. (more…)

Posted in PHP, PHP Tips, Web Development

Leave a comment

I am on home page of oDesk, feels great

March 17th, 2009 by Fahd

Hi guys

I am feeling good right now. Have been working on oDesk from Feb 17, 2009. And its good you get paid on hourly basis. I like oDesk the most among freelancing sites I have worked on. Anyhow, I took a few screen shots to show you that I was once featured on home page on oDesk.

(more…)

Posted in PHP, Portfolio, Web Development, Wordpress

1 Comment

PHP: How to rewmove last comma from a string

November 25th, 2008 by Fahd

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.

Posted in PHP Tips

Leave a comment

Thanks Rasmus Lerdorf, you made my day

September 12th, 2008 by Fahd

OK folks, I think I had announced on my blog that I am under contract with Packt Publishing to write a book about PHP team oriented development. The official title would be “PHP Team Development”.

This is not a publicity campaign of my book yet another sigh of relief that what I am doing is even supported by the creator of PHP. Yes his name is Rasmus Lerdorf. The guy has been doing quite a research about PHP frameworks. Anyhow, the great news is that he found CodeIgniter the best optimal framework for PHP MVC based  application development. OK so I am sharing the complete article from sitepoint where I read the news.

(more…)

Posted in General

2 Comments

Team Work: Candidate # 1 for my Book titled “PHP Team Development”

September 10th, 2008 by Fahd

Team Work!, originally uploaded by annamir ™.

(more…)

Posted in General

Leave a comment

Convert date formats between PHP and MySQL (mm/dd/yyyy to yyyy-mm-dd)

September 8th, 2008 by Fahd

I have a view in HWC where I am using Javascript DHTML date picker script to pick the date and insert into test field. By the way HWC is the PHP-MVC (using codeigniter) application I am working on.

Date Picker in dhtml/Javascript

Date Picker in dhtml/Javascript

(more…)

Posted in CodeIgniter, PHP, Web Development

1 Comment

WordPress Plugin: Get recent posts within a dynamic wordpress content page or post from 2 different categories

March 15th, 2008 by Fahd

OK I usually work on the wordpress stuff and do all the fancy things with wordpress on these two Blogs of Josh Freedman

His press room at http://www.6seconds.org/press/
His blog is at http://6seconds.org/blog/


I spent my times for release and support my plugin. If you like my plugin and enjoy the support, do consider to make a donation to me. Thank you :D . I am available for hire too :)

You can view the plugin working at his press room at http://www.6seconds.org/press/

Its showing the 2 different categories’ recent posts. The number of the posts can be defined in the plugin’s only php file.
Wordpress Plugin: Get recent posts within a dynamic wordpress content page or post

OK how to do such thing?

I am going to release a modified generic open source version if Josh allows me.

Update 1:33 AM : Yeah he allows me :) so here is the download material (on full post page).. (more…)

Posted in Blogging Engines, Open Source, PHP, Plugins, Web 2.0, Web Development, Web Development Software, Wordpress

Leave a comment

Mining the Web using PHP

March 4th, 2008 by farhan042

There are many ways for Extracting or fetching desired data or content from an html pages. During my work, i had to build a Miner to get news from multiple sites & update a wordpress blog with the latest news, daily.I had many choices to accomplish this task, few of them are
- Regular expressions
- PHP string functions.
- Using DOM Parsing
- Using Xpath.

First of all i used regular expressions to (more…)

Posted in data-mining, Databases, Open Source, PHP, Web 2.0, Web Development, Web Development Software

2 Comments

  • 1
  • 2
  • »
  • Categories


Want to Hire Me?


Fahd Murtaza is the guy behind fahdmurtaza.com: your source for getting your web development projects done. Fahd sepcialises in Open Source Web Development and his favorite is WordPress. This site is a platform to his web development portfolio and blog all on a newly designed responsive website—try viewing it on your mobile.

If after viewing Fahd's portfolio, you think he might be just the guy to hire for your web / application development; check out the web development pricing page, then find out how to hire Fahd with a web development project idea and a brief of requirements.

 


Fahd Murtaza has put together a number of Web Development Articles that will help you see what he does, how he does it. You will also be able to see the level of work, and passion, that Fahad puts into each and every job. Understanding a little about the process can make the idea of investing good money much more palatable. People have always appreciated my Agile techniques. Its time you

Fahd Murtaza, Web Developer, Programmer, Wordpress Expert
U
This is portfolio & blog of senior web developer Fahd Murtaza, who has 9 years experience in: website development, WordPress, drupal, CMS and CRM application development with passion of making web better; one site at a time.


@
Mobile +968 93 678 199
email info@fahdmurtaza.com
Google Talk: fahdim@gmail.com
Skype fahd.murtaza
Location Muscat, Oman.


_
Developed using my beloved, love of my life, WordPress, built on the responsive, grid based, mobile optimised, Foundation Framework, and a modified Foundation theme. More Info →


Follow Fahd: Twitter / Google+ / Instagram / Facebook / Dribbble / Tumblr / Posterous /
Copyright © 2006-2012 Fahd Murtaza

    • WordPress.org
    • Documentation
    • Support Forums
    • Feedback