Category: PHP/Javascripts/jQuery

Creating Pie Chart in PHP

Here’s a simple way to create a pie chart from PHP. Thanks to rasmus of peters1.dk Required from PHP-installation: This script requires GD 2.0.1 or later to be installed on your webserver. This script...

More

PHP Get string between tags

Here’s a very basic function but a very useful one if you need to get text/string between html tags using PHP. <?php function getTextBetweenTags($string, $tagname) { $pattern = “/<$tagname>(.*?)<\/$tagname>/”; preg_match($pattern, $string, $matches); return $matches[1];...

More

How to replace the first occurrence of a string (PHP)

Wondering how to replace in php the only first occurrence of the string? just copy and paste this code. <? function str_replace_count($search,$replace,$subject,$times) { $subject_original=$subject; $len=strlen($search); $pos=0; for ($i=1;$i<=$times;$i++) { $pos=strpos($subject,$search,$pos); if($pos!==false) { $subject=substr($subject_original,0,$pos); $subject.=$replace;...

More

World Clock Script

This is program in javascript that shows the time around the world just by selecting a country or a specific city. The system will display the time in that area. Everybody can use this...

More