自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

分析和解析PHP代碼的7大工具

開(kāi)發(fā) 后端
PHP已成為時(shí)下最熱門(mén)的編程語(yǔ)言之一,然而卻有許多PHP程序員苦惱找不到合適的工具來(lái)幫助自己分析和解析PHP代碼。今天小編就為大家介紹幾個(gè)非常不錯(cuò)的工具,來(lái)幫助程序員們提高自己的工作效率,一起來(lái)看看吧!

PHP已成為時(shí)下最熱門(mén)的編程語(yǔ)言之一,然而卻有許多PHP程序員苦惱找不到合適的工具來(lái)幫助自己分析和解析PHP代碼。今天小編就為大家介紹幾個(gè)非常不錯(cuò)的工具,來(lái)幫助程序員們提高自己的工作效率,一起來(lái)看看吧!

[[136778]]

PHP Parser

PHP-Parser是一個(gè)用PHP編寫(xiě)的PHP解析器(支持PHP 5.4以及更早的版本),這種特殊的解析器非常適合靜態(tài)代碼分析。該工具的目的就是簡(jiǎn)化靜態(tài)代碼分析和操作,它使程序員能夠以編程的方式來(lái)處理任何應(yīng)用程序的代碼。 

PHPSandbox

PHPSandbox將運(yùn)行PHP作為獨(dú)立進(jìn)程的一種方式。 它為程序員提供一種外圍腳本的保護(hù),比如錯(cuò)誤、崩潰、運(yùn)行慢的腳本,或者不適合在代碼中運(yùn)行的腳本,都可作為獨(dú)立進(jìn)程來(lái)運(yùn)行。

PHP Mess Detector

PHPMD這個(gè)工具能夠探測(cè)PHP源代碼中一些潛在的問(wèn)題。例如:

  • 可能存在的Bug
  • 未達(dá)最佳標(biāo)準(zhǔn)的代碼
  • 過(guò)于復(fù)雜的語(yǔ)法
  • 從未使用過(guò)的參數(shù)、方法、屬性

PHPCPD

PHPCPD是一個(gè)在代碼中尋找類似模式的工具,使用它是為了在代碼庫(kù)中識(shí)別代碼在何處被復(fù)制或粘貼。這是常規(guī)構(gòu)建過(guò)程中一個(gè)非常有用的工具,它會(huì)幫助程序員分析代碼,以避免在代碼庫(kù)中重復(fù)調(diào)用函數(shù)。

PHPCheckstyle

PHPCheckstyle是一個(gè)幫助PHP程序員檢查代碼和報(bào)告錯(cuò)誤的工具,運(yùn)行于PHP 5.0以及更高的版本。通過(guò)SVN鉤子腳本的方式來(lái)調(diào)用PHPCheckstyle,可以強(qiáng)制代碼必須符合預(yù)先設(shè)定的編碼標(biāo)準(zhǔn)(比如PEAR編碼標(biāo)準(zhǔn)),有助于在多人合作項(xiàng)目中提高代碼整體質(zhì)量。

Ubench

Ubench是一個(gè)用于評(píng)測(cè)PHP代碼執(zhí)行時(shí)間和內(nèi)存使用效率的開(kāi)發(fā)庫(kù)。使用方法如下:

 

  1. require_once 'src/Ubench.<span id="1_nwp" style="width: auto; height: auto; float: none;"><a id="1_nwl" href="http://cpro.baidu.com/cpro/ui/uijs.php?app_id=0&c=news&cf=1001&ch=0&di=128&fv=11&is_app=0&jk=f35ff87300cda873&k=php&k0=php&kdi0=0&luki=8&n=10&p=baidu&q=06011078_cpr&rb=0&rs=1&seller_id=1&sid=73a8cd0073f85ff3&ssp2=1&stid=0&t=tpclicked3_hc&tu=u1922429&u=http%3A%2F%2Fwww%2Eadmin10000%2Ecom%2Fdocument%2F6257%2Ehtml&urlid=0" target="_blank" mpid="1" style="text-decoration: none;"><span style="color:#0000ff;font-size:14px;width:auto;height:auto;float:none;">php</span></a></span>'
  2.  
  3. $bench = new Ubench; 
  4.  
  5. $bench->start(); 
  6.  
  7. // Execute some code 
  8.  
  9. $bench->end(); 
  10.  
  11. // Get elapsed time and <span id="2_nwp" style="width: auto; height: auto; float: none;"><a id="2_nwl" href="http://cpro.baidu.com/cpro/ui/uijs.php?app_id=0&c=news&cf=1001&ch=0&di=128&fv=11&is_app=0&jk=f35ff87300cda873&k=memory&k0=memory&kdi0=0&luki=4&n=10&p=baidu&q=06011078_cpr&rb=0&rs=1&seller_id=1&sid=73a8cd0073f85ff3&ssp2=1&stid=0&t=tpclicked3_hc&tu=u1922429&u=http%3A%2F%2Fwww%2Eadmin10000%2Ecom%2Fdocument%2F6257%2Ehtml&urlid=0" target="_blank" mpid="2" style="text-decoration: none;"><span style="color:#0000ff;font-size:14px;width:auto;height:auto;float:none;">memory</span></a></span> 
  12.  
  13. echo $bench->getTime(); // 156ms or 1.123s 
  14.  
  15. echo $bench->getTime(true); // elapsed microtime in float 
  16.  
  17. echo $bench->getTime(false'%d%s'); // 156ms or 1s 
  18.  
  19. echo $bench->getMemoryPeak(); // 152B or 90.00Kb or 15.23Mb 
  20.  
  21. echo $bench->getMemoryPeak(true); // memory <span id="3_nwp" style="width: auto; height: auto; float: none;"><a id="3_nwl" href="http://cpro.baidu.com/cpro/ui/uijs.php?app_id=0&c=news&cf=1001&ch=0&di=128&fv=11&is_app=0&jk=f35ff87300cda873&k=peak&k0=peak&kdi0=0&luki=3&n=10&p=baidu&q=06011078_cpr&rb=0&rs=1&seller_id=1&sid=73a8cd0073f85ff3&ssp2=1&stid=0&t=tpclicked3_hc&tu=u1922429&u=http%3A%2F%2Fwww%2Eadmin10000%2Ecom%2Fdocument%2F6257%2Ehtml&urlid=0" target="_blank" mpid="3" style="text-decoration: none;"><span style="color:#0000ff;font-size:14px;width:auto;height:auto;float:none;">peak</span></a></span> in bytes 
  22.  
  23. echo $bench->getMemoryPeak(false'%.3f%s'); // 152B or 90.152Kb or 15.234Mb 
  24.  
  25. // Returns the memory usage at the end <span id="4_nwp" style="width: auto; height: auto; float: none;"><a id="4_nwl" href="http://cpro.baidu.com/cpro/ui/uijs.php?app_id=0&c=news&cf=1001&ch=0&di=128&fv=11&is_app=0&jk=f35ff87300cda873&k=mark&k0=mark&kdi0=0&luki=2&n=10&p=baidu&q=06011078_cpr&rb=0&rs=1&seller_id=1&sid=73a8cd0073f85ff3&ssp2=1&stid=0&t=tpclicked3_hc&tu=u1922429&u=http%3A%2F%2Fwww%2Eadmin10000%2Ecom%2Fdocument%2F6257%2Ehtml&urlid=0" target="_blank" mpid="4" style="text-decoration: none;"><span style="color:#0000ff;font-size:14px;width:auto;height:auto;float:none;">mark</span></a></span> 
  26.  
  27. echo $bench->getMemoryUsage(); // 152B or 90.00Kb or 15.23Mb

PHP Analyzer

PHP Analyzer執(zhí)行和編譯器相同的流動(dòng)分析,確保代碼在每個(gè)潛在執(zhí)行路徑的每一行都執(zhí)行了測(cè)試。這種特殊的工具幫助開(kāi)發(fā)人員提高了自己的代碼質(zhì)量,從而確保了工作效率。

責(zé)任編輯:王雪燕 來(lái)源: 博客園
相關(guān)推薦

2016-08-29 22:34:24

大數(shù)據(jù)工具

2011-07-12 17:33:09

PHP

2021-07-26 05:38:53

IaC基礎(chǔ)設(shè)施即代碼開(kāi)發(fā)

2010-04-23 15:18:51

Oracle性能優(yōu)化

2009-03-02 09:14:00

2020-06-28 09:56:48

.NET開(kāi)發(fā)工具

2023-08-02 11:39:11

鏈路追蹤技術(shù)微服務(wù)

2011-08-09 11:01:01

MySQL

2009-08-26 10:54:02

Linux無(wú)線網(wǎng)絡(luò)

2016-03-21 09:56:41

Spark大數(shù)據(jù)處理Apache

2010-08-02 12:18:12

ADSL撥號(hào)錯(cuò)誤代碼

2013-09-24 10:32:31

Android開(kāi)發(fā)者工具

2023-11-03 09:41:16

2024-03-15 11:31:13

2012-06-15 14:38:29

Hadoop分布式文件系統(tǒng)

2015-01-06 13:42:45

跨平臺(tái)開(kāi)發(fā)APP工具

2017-10-30 22:22:34

程序員

2022-09-02 15:25:59

程序員工具項(xiàng)目

2011-03-31 10:18:31

2018-04-12 10:02:57

大數(shù)據(jù)領(lǐng)域工具
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)