<?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>飞扬轻狂&#039;s blog &#187; 小代码</title>
	<atom:link href="http://blog.fallseir.com/tag/%e5%b0%8f%e4%bb%a3%e7%a0%81/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.fallseir.com</link>
	<description>我心飞扬 我意轻狂</description>
	<lastBuildDate>Thu, 06 May 2010 07:13:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/><cloud domain='blog.fallseir.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>php的多分支控制</title>
		<link>http://blog.fallseir.com/2009/04/php_more_ifelse/</link>
		<comments>http://blog.fallseir.com/2009/04/php_more_ifelse/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 06:57:32 +0000</pubDate>
		<dc:creator>飞扬轻狂</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[小代码]]></category>

		<guid isPermaLink="false">http://blog.fallseir.com/?p=129</guid>
		<description><![CDATA[php的多分支控制 &#8211; 原文 (飞扬轻狂,fallseir) 20090427 ==== php的多分支控制 ==== ### if 方式 实现多分支控制 if(runStep(1)){ if(runStep(2)){ if(runStep(3)){ # all steps are success!! }else{ # step 03 is failed! } }else{ # step 03 is failed! } }else{ # step 03 is failed! } # some others steps ### if 方式 2 实现多分支控制 $r=0; if(runStep(1)) if(runStep(2)) if(runStep(3)) else [...]]]></description>
			<content:encoded><![CDATA[<p>php的多分支控制<br />
&#8211; <a href="http://blog.fallseir.com/2009/04/php_more_ifelse/">原文</a> (飞扬轻狂,fallseir) 20090427<br />
==== php的多分支控制 ====<br />
### if 方式 实现多分支控制</p>
<pre>
if(runStep(1)){
  if(runStep(2)){
    if(runStep(3)){
      # all steps are success!!
    }else{
	# step 03 is failed!
    }
  }else{
    # step 03 is failed!
  }
}else{
  # step 03 is failed!
}

# some others steps
</pre>
<p>### if 方式 2 实现多分支控制</p>
<pre>
$r=0;
if(runStep(1))
  if(runStep(2))
    if(runStep(3))
    else $r=3;
  else $r=2;
else $r=1;
if($r){
  # step $r is failed!
  return false;
}

# some others steps
</pre>
<p>### do..while(false) 方式 2 实现多分支控制</p>
<pre>
do{
  if(!runStep(1)) # step 01 is failed!
  break;
  if(!runStep(2)) # step 02 is failed!
  break;
  if(!runStep(3)) # step 03 is failed!
  break;
  # all steps are success!!
}while(false);

# some others steps
</pre>
<p>### switch(true) 方式 2 实现多分支控制</p>
<pre>
switch(true){
  case !runStep(1):
	# step 01 is failed!
	break;
  case !runStep(2):
	# step 02 is failed!
	break;
  case !runStep(3):
	# step 03 is failed!
	break;
  default:
	# all steps are success!!
    break;
}

# some others steps
</pre>
<p>### try..catch 方式实现</p>
<pre>
try{
  if(!runStep(1)) throw new SomeError(1); # step 01 is failed!
  if(!runStep(2)) throw new SomeError(2); # step 02 is failed!
  if(!runStep(3)) throw new SomeError(3); # step 01 is failed!
  # all steps are success!!
}catch(SomeError $ex){
  # step $ex is failed!
  return false;
}
# some others steps
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.fallseir.com/2009/04/php_more_ifelse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用反射 实现的 简单的 单元测试框架</title>
		<link>http://blog.fallseir.com/2009/04/php_simple_unit_test/</link>
		<comments>http://blog.fallseir.com/2009/04/php_simple_unit_test/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 06:37:06 +0000</pubDate>
		<dc:creator>飞扬轻狂</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[unit test]]></category>
		<category><![CDATA[小代码]]></category>

		<guid isPermaLink="false">http://blog.fallseir.com/?p=127</guid>
		<description><![CDATA[使用反射 实现的 简单的 单元测试框架 &#8211; 原文 (飞扬轻狂,fallseir) 20090427 ==== generalized test methods use introspection ==== class customClass{ function selfTest(){[..] return [message&#124;false]} } class tester{ function test($thing){ if(is_object($thing)){ if(method_exists($thing,'selfTest')){ $this->handleTest(call_user_method('selfTest',$thing)); } }else if(is_array($thing)){ foreach($thing as $component){ $this->test($component); } }else{ ;//ignore if not an array or object } } function handleTest($result){if($result)print "Warning $result";} } 参考: John.Wiley.and.Sons.PHP5.and.MySQL.Bible]]></description>
			<content:encoded><![CDATA[<p>使用反射 实现的 简单的 单元测试框架<br />
&#8211; <a href="http://blog.fallseir.com/2009/04/php_simple_unit_test/">原文</a> (飞扬轻狂,fallseir) 20090427<br />
==== generalized test methods use introspection ====</p>
<pre>
class customClass{
  function selfTest(){[..] return [message|false]}
}
class tester{
  function test($thing){
    if(is_object($thing)){
      if(method_exists($thing,'selfTest')){
        $this->handleTest(call_user_method('selfTest',$thing));
      }
    }else if(is_array($thing)){
      foreach($thing as $component){ $this->test($component); }
    }else{
    ;//ignore if not an array or object
    }
  }
  function handleTest($result){if($result)print "Warning $result";}
}
</pre>
<p>参考:<br />
John.Wiley.and.Sons.PHP5.and.MySQL.Bible</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fallseir.com/2009/04/php_simple_unit_test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
