| | |
Find String in PHP Ready easy function
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Better way to find String in PHP ! instead of substring and other php function , This function takes Start and End , and it will return the String in between in another variable ! you can call it easily
function findtxt($start,$end,$str,&$var) { if(stristr($str,$start) && stristr($str,$end)) { $txt_pos_s = strpos($str,$start) + strlen($start); $txt_pos_e = strpos($str,$end,$txt_pos_s); $txt_length = $txt_pos_e - $txt_pos_s; $txt = substr($str,$txt_pos_s,$txt_length); $var = $txt; return TRUE; } else { return FALSE; } } //Call the function $str="Address 1: Cairo 14 Street </br> Address 2: bla bla bla "; findtxt('Address 1:','Address 2:',$str,$s1); // then you can remove the html tags from the result string which is $s1 $s1=strip_tags($s1);
Similar Threads
- How could i find string that it's the end with "," and "." ? (Java)
- string in php (PHP)
- search for string in text file then find a different string after (C++)
- find string in txt file (C++)
- How to allow php tags with strip_tags function (PHP)
- Better Solution? String Builder? Censor List Function (ASP.NET)
- Search for a string in a variable--- (PHP)
- Problem with string variable in void prnt function (C++)
- Redirected to "http://search-to-find.com/sec.php?qq=car&pin=37049" (Viruses, Spyware and other Nasties)
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery js limit link login loop mail mediawiki menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql stored structure subdomain syntax system table tutorial update updates upload url validation validator variable video web xml youtube



