SitePoint Sponsor |
|
User Tag List
Results 1 to 9 of 9
Thread: Most common PHP functions
-
Aug 5, 2007, 20:09 #1
Most common PHP functions
What are the most common php functions you use?
Or, what are the most common php code you use? For example, loops, if statements etc.
If you use dreamweaver what do you keep in "snippets" because you use them a lot?
-Todd
-
Aug 5, 2007, 20:15 #2
- Join Date
- Nov 2004
- Location
- Right behind you, watching, always watching.
- Posts
- 5,431
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
sorry but EW YUCK
most common ones I use?
str_replace
strpos
strip_tags
most common loops? it's a toss up between while and foreach ... both for good reasons:
PHP Code:while($row = $db_obj->getRows()) {
}
PHP Code:foreach ($array as $key => $value) {
}
-
Aug 5, 2007, 20:39 #3
What's so EWW Yuck, about dreamweaver?
-
Aug 5, 2007, 23:32 #4
Split and trim would have to be the functions I use the most!
Sara
-
Aug 5, 2007, 23:34 #5
echo and var_dump perhaps.
-
Aug 5, 2007, 23:41 #6
-
Aug 5, 2007, 23:48 #7
- Join Date
- Oct 2006
- Location
- Kathmandu, Nepal
- Posts
- 4,013
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Kailash, i have another one print_r() too.
And other than the functions of PHP the word "test" is my regular word that I use more frequently. Lol!Mistakes are proof that you are trying.....
------------------------------------------------------------------------
PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5
-
Aug 6, 2007, 00:13 #8
Originally Posted by logic_earth
Yeah that little PHP language construct has been very handy though, my lord!
-
Aug 6, 2007, 01:49 #9
- Join Date
- Apr 2004
- Location
- germany
- Posts
- 4,324
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
PHP Code:<?php
if(preg_match('/win/i', PHP_OS))
$cmd = "dir /b/s *.php";
else
$cmd = "find -name *.php";
$funcs = array_merge(
reset(get_defined_functions()),
explode(",", "array,list,echo,print,unset,isset,empty,include,include_once,require,require_once")
);
$files = explode("\n", trim(`$cmd`));
foreach($files as $file) {
preg_match_all("~(\w+)\s*\(~", file_get_contents($file), $m);
$counts = array_count_values($m[1]);
foreach(array_intersect($funcs, $m[1]) as $funcname)
@$calls[$funcname] += $counts[$funcname];
}
$fmt = "%25s %5d\n";
printf($fmt, "FILES", count($files));
printf($fmt, "CALLS", array_sum($calls));
arsort($calls);
foreach($calls as $func => $cnt)
printf($fmt, $func, $cnt);
Code:FILES 89 CALLS 2554 array 699 strlen 122 count 105 isset 84 define 74 intval 68 strpos 66 explode 48 preg_match 48 user_error 46 unset 45 preg_replace 45 trim 40 implode 39 substr 37 is_array 35 list 29 date 23 reset 21
Bookmarks