Hi, As a developer life can be very easy if you can find ready made useful scripts, so I am starting a thread to share scripts which can be useful to everyone. here is one such method Bookmarking javascript <script type="text/javascript"> function bookmarksite(title,url) { if (window.sidebar) window.sidebar.addPanel(title, url, ""); else if(window.opera && window.print){ var elem = document.createElement('a'); elem.setAttribute('href',url); elem.setAttribute('title',title); elem.setAttribute('rel','sidebar'); elem.click(); } else if(document.all) window.external.AddFavorite(url, title); } </script> This method can be called like this: <a href="javascript:bookmarksite('your site titile', 'http://www.YourSite.com')"><strong>Liked it? Bookmark this site!</strong></a> Do share any such useful function you have.
This is a function to find a string between 2 strings: function get_string_between($string, $start, $end) { $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini; return substr($string,$ini,$len); }
raj, looks like good function (that second) but that first, what has that to do with PHP? However, good post
actually the title of the post should have been "useful scripts" not "useful PHP scripts" sorry for the typo