Analyse a PHP file for instantations and static calls

grep -o "\(new \(\w\+\)\|\w\+::\)" file.php | sed 's/new \|:://' | sort | uniq -c | sort
This grabs all lines that make an instantation or static call, then filters out the cruft and displays a summary of each class called and the frequency.
Sample Output
1 parent
1 product_Item
1 promotion_Base
1 swc_Response
2 product_ViewHelper
2 product_ViewTransformer
4 promotion_Tab
5 site_Template
6 self

-2
By: root
2009-01-26 12:08:47

What Others Think

home health care las vegas I was just wondering... I'm an android user now but I want to change it to that. How can I get started?
yeoyeo · 10 weeks ago
and on they went, till the activity was pretty done, and the footwear stood equipped to be used upon the desk. this become long before dawn; and then they bustled away as short as lightning. voip phone system
andomthe · 4 weeks and 1 day ago
Make decisions now as to what you will use and what you will discard. This is harder than you might think master-paper.com because often interesting evidence you have unearthed has to be omitted simply because it isn’t relevant.
yukilo666 · 1 week and 5 days ago
All the faces in the world are mirrors. What kind of reflections do you see in the faces of the people you meet? voip phone system service provider
giaome · 1 week and 2 days ago
All the faces in the world are mirrors. What kind of reflections do you see in the faces of the people you meet? voip phone system service provider
giaome · 1 week and 2 days ago
Streaming is a constant telemedicine app features transmission of an audio and video file from a server to the client. In other words, streaming happens when you listen to music or watch videos on the Internet.
bebasik · 23 hours ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: