text processing - How to easily generate debugging statements for PHP code? -



text processing - How to easily generate debugging statements for PHP code? -

i need able generate debugging statements code. example, here code have:

$this->r->radius_ft = $this->tc->diameter / 24; $this->r->tbeta2_rad = $this->d->beta2 / $rad; //outer angle $this->r->tbeta1_rad = $this->r->inner_beta1 / $rad; //inner angle

i need able display results of computations can read human.

so far have been doing (example showing first line above only):

$this->r->radius_ft = $this->tc->diameter / 24; if (self::debug) print("radius_ft({$this->r->radius_ft}) = diameter({$this->tc->diameter}) / 24");

the above print radius_ft(1.4583) = diameter(35) / 24 , few of lines looks equations , nicely traceable when want verify things on paper, or if want expose intermediate work of computations else.

the problem is pain build debugging statements. craft them hand, , not problem, in current example, there hundreds of lines of code needs done. much pain.

i wondering if there facilities in php allow me create print-outs of statements showing each line of code does. or methods semi-automate creating debug lines me.

i have far discovered method cutting downwards on of work .... utilize macro facilities of text editor.

paste line of code textpad (or similar editor supports macros). record macro , utilize search, mark , re-create facilities navigate between special symbols of variable, such $, >, , symbols not alphanumeric or $, >, etc. while copying , extracting , pasting parts of variable craft particular statement.

exact steps may differ one's needs. macro operates on 1 variable $this->r->radius_ft cursor @ start , ends radius_ft({$this->r->radius_ft}), cursor few chars after end, coinciding next variable process.

perhaps same done regular expressions way macro - can process variable , go next 1 , repeat macro hot key combination. takes out tedious chunk of work me.

alternatively - hand person code , allow them figure out. teach them how read code.

php text-processing

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -