OM2 Posted August 17, 2011 Share Posted August 17, 2011 I'm not sure if this is a dumb question... but I thought I'd ask anyway!! How do I read code? OK, so let's say you have index.php, which requires a.php, b.php and c.php, which in turn require more files x.php, y.php, z.php etc When I read some code and come across a function being called, I wanted to know what that function does and how it's supposed to work If there is a function call in index.php called strangeWeirdFunction() and is passed a multitude of parameters, I'm left scratching my head trying to think what it might be there to do I find myself having to wingrep to find other files that reference the file All of this wastes loads of time Or maybe my approach is wrong? I thought an IDE like Netbeans would help in some way - I thought when I highlighted a function, it might give me links to where it was declared - unfortunately, this doesn't happen! Writing code from scratch + reading small amounts of code - I'm OK doing But, when it comes to a large project, I find it really daunting and always get lost in the spaghetti of code Just looking for general advice Thanks OM Quote Link to comment https://forums.phpfreaks.com/topic/244968-need-advice-on-how-to-read-code/ Share on other sites More sharing options...
AP81 Posted August 17, 2011 Share Posted August 17, 2011 http://php.net/manual/en/function.debug-backtrace.php Quote Link to comment https://forums.phpfreaks.com/topic/244968-need-advice-on-how-to-read-code/#findComment-1258385 Share on other sites More sharing options...
xyph Posted August 17, 2011 Share Posted August 17, 2011 I use Eclipse PDT and it does just that. When I start typing the function name, it's in the auto-complete list with the file name it was declared in. functionName($args) - originatingfile.php Quote Link to comment https://forums.phpfreaks.com/topic/244968-need-advice-on-how-to-read-code/#findComment-1258388 Share on other sites More sharing options...
OM2 Posted August 17, 2011 Author Share Posted August 17, 2011 http://php.net/manual/en/function.debug-backtrace.php sorry for being dumb, i've only just scan read - but i don't see how this helps? thanks I use Eclipse PDT and it does just that. When I start typing the function name, it's in the auto-complete list with the file name it was declared in. functionName($args) - originatingfile.php great. just googled and tried finding a download does it still exist? i saw the following: Looking for the Eclipse for PHP Developers Package? Due to lack of a package maintainer for the Indigo release there will be no PHP (PDT) package. If you would like to install PDT into your Eclipse installtion you can do so by using the Install New Software feature from the Help Menu and installing the PHP Development Tools (PDT) SDK Feature from the Eclipse Indigo Repo >> http://download.eclipse.org/releases/indigo Quote Link to comment https://forums.phpfreaks.com/topic/244968-need-advice-on-how-to-read-code/#findComment-1258391 Share on other sites More sharing options...
trq Posted August 17, 2011 Share Posted August 17, 2011 Netbeans does much the same. Hold down shift and click a function / method and it will open the file it is declared in at the line it is declared on. Quote Link to comment https://forums.phpfreaks.com/topic/244968-need-advice-on-how-to-read-code/#findComment-1258473 Share on other sites More sharing options...
OM2 Posted August 17, 2011 Author Share Posted August 17, 2011 thorpe, that's awesome it's not shift, it's ctrl OMG, this is more awesome than i thought! one thing that i always stumble on is functions that are php functions when u ctrl click a php function, it opens up the php file where it was declared! yee ha! thanks!! :) Quote Link to comment https://forums.phpfreaks.com/topic/244968-need-advice-on-how-to-read-code/#findComment-1258503 Share on other sites More sharing options...
$php_mysql$ Posted August 17, 2011 Share Posted August 17, 2011 kombodo also does that Quote Link to comment https://forums.phpfreaks.com/topic/244968-need-advice-on-how-to-read-code/#findComment-1258509 Share on other sites More sharing options...
OM2 Posted August 17, 2011 Author Share Posted August 17, 2011 netbeans = free komodo = expensive, you have to pay money! netbeans = not as good because it's free! komodo = much much better because it's commercial? is the above correct? if better how much better? (not sure how one can quantify that!) been to the activestate website. i must have spent 5 min looking around for the price. i'm sure it's there somewhere can u tell me how much? i couldn't find myself thanks Quote Link to comment https://forums.phpfreaks.com/topic/244968-need-advice-on-how-to-read-code/#findComment-1258611 Share on other sites More sharing options...
xyph Posted August 17, 2011 Share Posted August 17, 2011 In a professional environment, komodo is worth it IMO. For amateur coding, and heck, even professional environments, netbeans is helpful enough. As for Eclipse PDT http://www.eclipse.org/pdt/downloads/ Quote Link to comment https://forums.phpfreaks.com/topic/244968-need-advice-on-how-to-read-code/#findComment-1258660 Share on other sites More sharing options...
OM2 Posted August 17, 2011 Author Share Posted August 17, 2011 eclipse is free? i've heard it mentioned plenty of other places before downloading now i'm on a mission to become a competent php coder - so trying out the different packages is great for me also, PDT stands for what? i didn't want to ask such a dumb question, so i googled and all i got was: Pacific Daylight Time it must mean something else obviously! Quote Link to comment https://forums.phpfreaks.com/topic/244968-need-advice-on-how-to-read-code/#findComment-1258664 Share on other sites More sharing options...
xyph Posted August 17, 2011 Share Posted August 17, 2011 PHP Development Tools http://www.eclipse.org/projects/project.php?id=tools.pdt Quote Link to comment https://forums.phpfreaks.com/topic/244968-need-advice-on-how-to-read-code/#findComment-1258667 Share on other sites More sharing options...
OM2 Posted August 17, 2011 Author Share Posted August 17, 2011 PDT = PHP Development Tools? I haven't seen the term used elsewhere (Then again, I wouldn't call myself a super expert yet) thanks Quote Link to comment https://forums.phpfreaks.com/topic/244968-need-advice-on-how-to-read-code/#findComment-1258674 Share on other sites More sharing options...
xyph Posted August 17, 2011 Share Posted August 17, 2011 I provided you with a link to the project's home page with big bold letters that say 'PHP Development Tools' Yes, PDT = PHP Development Tools Quote Link to comment https://forums.phpfreaks.com/topic/244968-need-advice-on-how-to-read-code/#findComment-1258682 Share on other sites More sharing options...
OM2 Posted August 17, 2011 Author Share Posted August 17, 2011 thanks Quote Link to comment https://forums.phpfreaks.com/topic/244968-need-advice-on-how-to-read-code/#findComment-1258687 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.