<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ask me Questions and get Answers ! &#187; Web Development</title>
	<atom:link href="http://askmetoo.com/category/internet/web-development/feed" rel="self" type="application/rss+xml" />
	<link>http://askmetoo.com</link>
	<description>Ask Questions and get Answers About everything for free!</description>
	<lastBuildDate>Wed, 02 May 2012 13:39:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>memcached set max memory used</title>
		<link>http://askmetoo.com/memcached-set-max-memory-used.htm</link>
		<comments>http://askmetoo.com/memcached-set-max-memory-used.htm#comments</comments>
		<pubDate>Wed, 02 May 2012 13:39:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[memcached]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://askmetoo.com/?p=261</guid>
		<description><![CDATA[memcached -d -m 2048 -u root - this console command set max used memory of memcached is 2048 MB memcached -h memcached 1.4.5 -p TCP port number to listen on (default: 11211) -U UDP port number to listen on (default: 11211, 0 is off) -s UNIX socket path to listen on (disables network support) -a [...]]]></description>
			<content:encoded><![CDATA[<p>memcached -d -m 2048 -u root<br />
<span id="more-261"></span><br />
- this console command set max used memory of memcached is 2048 MB</p>
<p> memcached -h<br />
memcached 1.4.5<br />
-p <num>      TCP port number to listen on (default: 11211)<br />
-U <num>      UDP port number to listen on (default: 11211, 0 is off)<br />
-s <file>     UNIX socket path to listen on (disables network support)<br />
-a <mask>     access mask for UNIX socket, in octal (default: 0700)<br />
-l <ip_addr>  interface to listen on (default: INADDR_ANY, all addresses)<br />
-d            run as a daemon<br />
-r            maximize core file limit<br />
-u <username> assume identity of <username> (only when run as root)<br />
-m <num>      max memory to use for items in megabytes (default: 64 MB)<br />
-M            return error on memory exhausted (rather than removing items)<br />
-c <num>      max simultaneous connections (default: 1024)<br />
-k            lock down all paged memory.  Note that there is a<br />
              limit on how much memory you may lock.  Trying to<br />
              allocate more than that would fail, so be sure you<br />
              set the limit correctly for the user you started<br />
              the daemon with (not for -u <username> user;<br />
              under sh this is done with &#8216;ulimit -S -l NUM_KB&#8217;).<br />
-v            verbose (print errors/warnings while in event loop)<br />
-vv           very verbose (also print client commands/reponses)<br />
-vvv          extremely verbose (also print internal state transitions)<br />
-h            print this help and exit<br />
-i            print memcached and libevent license<br />
-P <file>     save PID in <file>, only used with -d option<br />
-f <factor>   chunk size growth factor (default: 1.25)<br />
-n <bytes>    minimum space allocated for key+value+flags (default: 48)<br />
-L            Try to use large memory pages (if available). Increasing<br />
              the memory page size could reduce the number of TLB misses<br />
              and improve the performance. In order to get large pages<br />
              from the OS, memcached will allocate the total item-cache<br />
              in one large chunk.<br />
-D <char>     Use <char> as the delimiter between key prefixes and IDs.<br />
              This is used for per-prefix stats reporting. The default is<br />
              &#8220;:&#8221; (colon). If this option is specified, stats collection<br />
              is turned on automatically; if not, then it may be turned on<br />
              by sending the &#8220;stats detail on&#8221; command to the server.<br />
-t <num>      number of threads to use (default: 4)<br />
-R            Maximum number of requests per event, limits the number of<br />
              requests process for a given connection to prevent<br />
              starvation (default: 20)<br />
-C            Disable use of CAS<br />
-b            Set the backlog queue limit (default: 1024)<br />
-B            Binding protocol &#8211; one of ascii, binary, or auto (default)<br />
-I            Override the size of each slab page. Adjusts max item size<br />
              (default: 1mb, min: 1k, max: 128m)</p>
]]></content:encoded>
			<wfw:commentRss>http://askmetoo.com/memcached-set-max-memory-used.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php call function on exit</title>
		<link>http://askmetoo.com/php-call-function-on-exit.htm</link>
		<comments>http://askmetoo.com/php-call-function-on-exit.htm#comments</comments>
		<pubDate>Fri, 27 Apr 2012 15:10:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://askmetoo.com/?p=256</guid>
		<description><![CDATA[you need to use http://php.net/manual/en/function.register-shutdown-function.php]]></description>
			<content:encoded><![CDATA[<p><span id="more-256"></span><br />
you need to use http://php.net/manual/en/function.register-shutdown-function.php</p>
]]></content:encoded>
			<wfw:commentRss>http://askmetoo.com/php-call-function-on-exit.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>301 javascript redirect for google from old website domain to new domain</title>
		<link>http://askmetoo.com/301-javascript-redirect-for-google-from-old-website-domain-to-new-domain.htm</link>
		<comments>http://askmetoo.com/301-javascript-redirect-for-google-from-old-website-domain-to-new-domain.htm#comments</comments>
		<pubDate>Mon, 02 Apr 2012 09:00:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://askmetoo.com/?p=251</guid>
		<description><![CDATA[1 2 3 4 5 6 7 8 &#60;script language=&#34;javascript&#34; type=&#34;text/javascript&#34;&#62; var loc = document.location.href + &#34;&#34;; &#160; loc = loc.replace(&#34;old-website.ru&#34;, &#34;new-website.ru&#34;); &#160; document.write ('&#60;meta http-equiv=&#34;refresh&#34; content=&#34;0;url='+loc+'&#34; /&#62;'); document.write (loc); &#60;/script&#62;]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;
	var loc = document.location.href + &quot;&quot;;
&nbsp;
	loc = loc.replace(&quot;old-website.ru&quot;, &quot;new-website.ru&quot;);
&nbsp;
	document.write ('&lt;meta http-equiv=&quot;refresh&quot; content=&quot;0;url='+loc+'&quot; /&gt;');
	document.write (loc);
&lt;/script&gt;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://askmetoo.com/301-javascript-redirect-for-google-from-old-website-domain-to-new-domain.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>gz unzip gz file from php</title>
		<link>http://askmetoo.com/gz-unzip-gz-file-from-php.htm</link>
		<comments>http://askmetoo.com/gz-unzip-gz-file-from-php.htm#comments</comments>
		<pubDate>Wed, 21 Dec 2011 08:03:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://askmetoo.com/?p=245</guid>
		<description><![CDATA[php example code 1 2 3 4 5 6 7 8 9 10 11 12 &#60;?php function uncompress&#40;$srcName, $dstName&#41; &#123; $sfp = gzopen&#40;$srcName, &#34;rb&#34;&#41;; $fp = fopen&#40;$dstName, &#34;w&#34;&#41;; &#160; while &#40;$string = gzread&#40;$sfp, 4096&#41;&#41; &#123; fwrite&#40;$fp, $string, strlen&#40;$string&#41;&#41;; &#125; gzclose&#40;$sfp&#41;; fclose&#40;$fp&#41;; &#125; uncompress&#40;'codhacks.sql.gz','codhacks.sql'&#41;;echo 1;exit;]]></description>
			<content:encoded><![CDATA[<p>php example code<br />
<span id="more-245"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> uncompress<span style="color: #009900;">&#40;</span><span style="color: #000088;">$srcName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dstName</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$sfp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">gzopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$srcName</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;rb&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dstName</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;w&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <span style="color: #990000;">gzread</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sfp</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4096</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #000088;">$string</span><span style="color: #339933;">,</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #990000;">gzclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sfp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
uncompress<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'codhacks.sql.gz'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'codhacks.sql'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>echo <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>exit<span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://askmetoo.com/gz-unzip-gz-file-from-php.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE7 CSS Hacks</title>
		<link>http://askmetoo.com/ie7-css-hacks.htm</link>
		<comments>http://askmetoo.com/ie7-css-hacks.htm#comments</comments>
		<pubDate>Mon, 20 Jun 2011 09:45:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://askmetoo.com/?p=229</guid>
		<description><![CDATA[#mm .rollOver { height: 165px; /* IE 6 &#038; bellow */ } html>body #mm .rollOver { height: 163px; /* FF &#038; Others */ } *:first-child+html #mm .rollOver { height: 165px !important; /* #%@#%(! IE 7 */ } p.style { color:red; } /* IE7 */ * html p.style { color:blue; } /* Other IE */ *&#124;html [...]]]></description>
			<content:encoded><![CDATA[<p>#mm .rollOver {<br />
   height: 165px; /* IE 6 &#038; bellow */<br />
}<br />
html>body #mm .rollOver {<br />
   height: 163px; /* FF &#038; Others */<br />
}<br />
*:first-child+html #mm .rollOver {<br />
   height: 165px !important; /* #%@#%(! IE 7 */<br />
}<br />
p.style { color:red; } /* IE7 */<br />
* html p.style { color:blue; } /* Other IE */<br />
*|html p.style { color:pink; } /* FF, Opera, Konqueror, Safari */</p>
<p>#ie7-hook-id div[class^="target-class"] { background: #ff0000; }<br />
div#ie7-hook-id .target-class { background: #0000ff; }</p>
<p>* div[class^="ie7-target-class"] { background: #ff0000; }<br />
body .ie7-target-class { background: #0000ff; }</p>
<p>Valid CSS Selectors</p>
<p>* html {} /* IE 6 and below */<br />
*:first-child+html {} * html {} /* IE 7 and below */<br />
*:first-child+html {} /* IE 7 only */<br />
html>body {} /* IE 7 and modern browsers only */<br />
html>/**/body {} /* Modern browsers only (not IE 7) */<br />
html:first-child {} /* Recent Opera versions 9 and below */</p>
]]></content:encoded>
			<wfw:commentRss>http://askmetoo.com/ie7-css-hacks.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>position: absolute center</title>
		<link>http://askmetoo.com/position-absolute-center.htm</link>
		<comments>http://askmetoo.com/position-absolute-center.htm#comments</comments>
		<pubDate>Mon, 21 Mar 2011 15:30:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://askmetoo.com/?p=213</guid>
		<description><![CDATA[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 &#60;div id=&#34;xyz_main&#34;&#62; &#60;div id=&#34;xyz_header&#34;&#62; Header &#60;/div&#62; &#60;div id=&#34;xyz_body&#34;&#62; Body &#60;/div&#62; &#160; &#60;div id=&#34;xyz_footer&#34;&#62; Footer &#60;/div&#62; &#60;/div&#62; #xyz_main { width: 140px; border: 1px solid #666666; text-align: left; position: absolute; top: 0px; left: 50%; margin-left: -70px; }]]></description>
			<content:encoded><![CDATA[<p><span id="more-213"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;xyz_main&quot;&gt;
    &lt;div id=&quot;xyz_header&quot;&gt; Header &lt;/div&gt;
    &lt;div id=&quot;xyz_body&quot;&gt; Body &lt;/div&gt;
&nbsp;
    &lt;div id=&quot;xyz_footer&quot;&gt; Footer &lt;/div&gt;
&lt;/div&gt;
#xyz_main {
    width: 140px;
    border: 1px solid #666666;
    text-align: left;
    position: absolute;
    top: 0px;
    left: 50%;
    margin-left: -70px;
}</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://askmetoo.com/position-absolute-center.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>preg replace html comments </title>
		<link>http://askmetoo.com/preg-replace-html-comments.htm</link>
		<comments>http://askmetoo.com/preg-replace-html-comments.htm#comments</comments>
		<pubDate>Tue, 15 Mar 2011 13:54:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://askmetoo.com/?p=209</guid>
		<description><![CDATA[How to remove all html &#60;!&#8211; &#8211;&#62; commnets ? use preg_replace("/&#60;!--.*?--&#62;/ms","",$str); or $test = "&#60;!--my comment goes here--&#62; Hello World &#60;!--------welcome--&#62;welcome"; echo  preg_replace('/\&#60;.*?\&#62;/','',$test); or preg_replace('/&#60;!--(.*)--&#62;/Uis', '', $html)]]></description>
			<content:encoded><![CDATA[<p>How to remove all html &lt;!&#8211; &#8211;&gt; commnets ?<span id="more-209"></span></p>
<p>use</p>
<pre><code>preg_replace("/&lt;!--.*?--&gt;/ms","",$str);
or
</code>
<pre><code>$test = "&lt;!--my comment goes here--&gt; Hello World &lt;!--------welcome--&gt;welcome";
echo  preg_replace('/\&lt;.*?\&gt;/','',$test);

or

</code>
<pre><code>preg_replace('/&lt;!--(.*)--&gt;/Uis', '', $html)

</code></pre>
</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://askmetoo.com/preg-replace-html-comments.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>how to Scroll   by javascript to footer of page ?</title>
		<link>http://askmetoo.com/how-to-scroll-by-javascript-to-footer-of-page.htm</link>
		<comments>http://askmetoo.com/how-to-scroll-by-javascript-to-footer-of-page.htm#comments</comments>
		<pubDate>Mon, 09 Aug 2010 15:18:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://askmetoo.com/?p=165</guid>
		<description><![CDATA[to Scroll to footer of page on javascript write 1 2 3 4 5 6 7 &#60;script language=&#34;JavaScript&#34;&#62; function getClientHeight&#40;&#41; &#123; return document.compatMode=='CSS1Compat' &#38;&#38; !window.opera?document.documentElement.clientHeight:document.body.clientHeight; &#125; window.scrollBy&#40;0,-getClientHeight&#40;&#41;&#41;; &#60;/script&#62;]]></description>
			<content:encoded><![CDATA[<p>to Scroll to footer of page on javascript<br />
write<br />
<span id="more-165"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;script language<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;JavaScript&quot;</span><span style="color: #00AA00;">&gt;</span>
function getClientHeight<span style="color: #00AA00;">&#40;</span><span style="color: #00AA00;">&#41;</span>
<span style="color: #00AA00;">&#123;</span>
  return document.compatMode<span style="color: #00AA00;">==</span><span style="color: #ff0000;">'CSS1Compat'</span> &amp;&amp; !window.opera?document<span style="color: #6666ff;">.documentElement</span><span style="color: #6666ff;">.clientHeight</span><span style="color: #3333ff;">:document</span><span style="color: #6666ff;">.body</span>.clientHeight<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
window.scrollBy<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">,</span>-getClientHeight<span style="color: #00AA00;">&#40;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
&lt;/script<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://askmetoo.com/how-to-scroll-by-javascript-to-footer-of-page.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPB 3.x.x text replace in all posts</title>
		<link>http://askmetoo.com/ipb-3-text-replace-in-all-posts.htm</link>
		<comments>http://askmetoo.com/ipb-3-text-replace-in-all-posts.htm#comments</comments>
		<pubDate>Tue, 26 Jan 2010 13:39:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[IPB]]></category>

		<guid isPermaLink="false">http://askmetoo.com/?p=146</guid>
		<description><![CDATA[Run this queries in phpmyadmin to replace text1 to text2 1 UPDATE `ibf_posts` SET post = REPLACE&#40;post, 'text1', 'text2'&#41;; Then do not forget to clear cache in admin side.]]></description>
			<content:encoded><![CDATA[<p><img src="http://fhq.forumer.com/images/iconz/ipb.gif" alt="" /><br />
Run this queries in phpmyadmin to replace text1 to text2<span id="more-146"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #ff0000;">`ibf_posts`</span> <span style="color: #993333; font-weight: bold;">SET</span> post <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>post<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'text1'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'text2'</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>Then do not forget to clear cache in admin side.</p>
]]></content:encoded>
			<wfw:commentRss>http://askmetoo.com/ipb-3-text-replace-in-all-posts.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Leave first image in text and cat length(howto)</title>
		<link>http://askmetoo.com/leave-first-image-in-text-and-cat-length.htm</link>
		<comments>http://askmetoo.com/leave-first-image-in-text-and-cat-length.htm#comments</comments>
		<pubDate>Wed, 28 Oct 2009 16:34:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Div]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[Place]]></category>
		<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://askmetoo.com/?p=130</guid>
		<description><![CDATA[This simple script makes good things! 1) leave first img tag 2) remove all another img tags 3) cut text by length So you get simple text short text with one image on it. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 [...]]]></description>
			<content:encoded><![CDATA[<p>This simple script makes good things!<br />
1) leave first <strong>img</strong> tag<br />
2) remove all another <strong>img</strong> tags<br />
3) cut text by length<br />
So you get simple text short text with one image on it.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> cut_text<span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$alli</span> <span style="color: #339933;">=</span> catch_that_image<span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$alli</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$x</span><span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$alli</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #000088;">$alli</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
        <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span>strip_only<span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;img&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$alli</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">700</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">700</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$y</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strrpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'&gt;...'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$x</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> catch_that_image<span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$first_img</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/&lt;img.+src=[\'&quot;]([^\'&quot;]+)[\'&quot;].*&gt;/i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #339933;">@</span><span style="color: #000088;">$first_img</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$matches</span> <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$imglen</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span> <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span> <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> AND <span style="color: #000088;">$imglen</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$imgpos</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stripos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span> <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$tx</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$imgpos</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span><span style="color: #339933;">,</span> <span style="color: #000088;">$imgpos</span><span style="color: #339933;">+</span><span style="color: #000088;">$imglen</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Vsio krome&lt;img&gt;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$tx</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tx</span><span style="color: #339933;">,</span><span style="color: #000088;">$matches</span> <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$imgpos</span><span style="color: #339933;">,</span> <span style="color: #000088;">$imglen</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> strip_only<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&gt;'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span> ? <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&gt;'</span><span style="color: #339933;">,</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">end</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">array_pop</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$tag</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$str</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'#&lt;/?'</span><span style="color: #339933;">.</span><span style="color: #000088;">$tag</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'[^&gt;]*&gt;#is'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$str</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #b1b100;">echo</span> cut_text<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;div class=&quot;content&quot; style=&quot;min-height: 202px;&quot;&gt;
&lt;img width=&quot;200&quot; height=&quot;200&quot; alt=&quot;Post Pic&quot; src=&quot;http://www.wprecipes.com/wp-content/uploads/2009/02/php2.jpg&quot;/&gt;
&lt;div class=&quot;pic fl&quot;&gt;
&lt;img width=&quot;200&quot; height=&quot;200&quot; alt=&quot;Post Pic&quot; src=&quot;http://www.wprecipes.com/wp-content/uploads/2009/02/php2.jpg&quot;/&gt;
&lt;/div&gt;
&lt;div class=&quot;post-title&quot;&gt;
&lt;/div&gt;
&lt;img width=&quot;200&quot; height=&quot;200&quot; alt=&quot;Post Pic&quot; src=&quot;http://www.wprecipes.com/wp-content/uploads/2009/02/php2.jpg&quot;/&gt;
&lt;div class=&quot;post-excerpt&quot;&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://askmetoo.com/leave-first-image-in-text-and-cat-length.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

