Category: phpexperts

Replace bad words in a string

Recently I came accross a pretty interesting problem through my group, phpexperts where someone needed a solution to replace badwords, but not if that word is a part of another word. For example if you consider the word “some” as bad, then you can replace all “some”, “.some”,”some,” but not “someone”.

Here is a solution I created for that prob
<?
$var = "somesomesome somesome some, some. someone .some ";
$badword = "some";
$var = preg_replace(array("/([\W]+){$badword}([\W]+)/","/([\W]+){$badword}([\W]+)/"),"$1".str_repeat("*",strlen($badword))."$2",$var);
echo $var;
?>

phpexperts get-together at 16th september, 2006

SomewhereIn

It was a great party yesterday we had at somewherein. From this month we started the phpexperts monthly meeting which is sponsored by somewherein this month. Yesterday we were scheduled to start at 3:00 pm. The first who knocked the door were tahsin, najnin and kamrunnahar. Tahsin is the member of phpexperts and other two were her interestd friends. Later Prasun and Biplob came in. Shortly after that we had Mizan bhai, Rinku da, Munaz bhai, murshed, Arafat bhai, hasn, Emon, joyeb, rafik bhai, shoeb bhai, raisul and another friend of rafik bhai.

We introduced somewherein and pageflakes in our meeting. We discussed about the current trends and the market situation. Everyone agree that we should increase the awareness abd professionalism in this field. RInku da and Mizan bhai shows us what is the current situation. Later we had an interesting presentation from Hasan regarding design patterns and then we all started talking about DP. Dp is always useful but unnecessary use of DP may decrease the productivity and increase the cost of project.

After hasan’s presentation we discussed about security features of an web application and I show how sql injection and xss could be vulnerable for your applications.

Mizan bhai and ringku da talked about some interesting issues regarding database optimization.

The most interesting part was after hours of the meeting. We 9 people were still there in some close conversation and we discussed about promoting php in Bangladesh as well as promoting the name of local developers and groups internationally. We all agreed that we should bring forward the name of Bangladesh in this sector. We planned about starting some open source projects. But starting it in large scale from the beginning wouldn’t be that much effective as we see many well planned initiative comes to an end because of communication gap and lack of management. So we planned to start it in small scale – our first open source project will be a “Bangla Chat Solution” – I advanced a bit in planning and I will share it with group from today.

Finally we got a fantastic idea to write a very good bangle book on PHP. Everyone was so happy with this idea that we were surprised – this is a real problem that there is no good bangle book in Bangladesh right now. So if we, the leading php community can start writing one, it would be great obviously. We setup a small group who are interested to write the book. Mizan bhai and I will manage the project and co ordinate the writers. Primarily I, Mizan bhai, Arafat bhai, Munaz bhai, Raisul, Hasan, Murshed and Prasun agree to write. But if anyone of you are interested, you are most welcome to join.

The meeting ends at 8:30 and we are very happy with the decisions taken. We hope that you will join in next meeting and participate with us in these interesting sessions.

Thanks to somewherein for sponsoring this great party.