note 108247 added to function.get-defined-functions

From: Date: Wed, 11 Apr 2012 17:03:18 +0000
Subject: note 108247 added to function.get-defined-functions
Groups: php.notes 
Request: Send a blank email to php-notes+get-187057@lists.php.net to get a copy of this message
list of user-defined function from file (in Array) with function + name only + arguments (as sub-Array) <?php // ----------------------------------------------------- $content = file_get_contents('functions.php'); $pattern = '/function (.*?){/'; preg_match_all($pattern, $content, $matches); // ------------------------------------ $i=0; foreach($matches[1] as $match) { $match = trim(chop($match)); $erg[$i]['function'] = $match; $funcname = explode('(',$match); $erg[$i]['funcname'] = trim($funcname[0]); $argstr = strrchr($match,'('); $argstr = str_replace(array('(',')',' '),array('','',''),$argstr); $argarr = explode(',',$argstr); $erg[$i]['funcargs'] = $argarr; $i++; } // ------------------------------------ print "<pre>\n"; print_r($erg); print "</pre>\n"; // ----------------------------------------------------- ?> Example Output: Array ( [0] => Array ( [function] => convertTag($tag, $direction = 'out') [funcname] => convertTag [funcargs] => Array ( [0] => $tag [1] => $direction='out' ) ) [1] => Array ( [function] => filter($data, $type = NULL) [funcname] => filter [funcargs] => Array ( [0] => $data [1] => $type=NULL ) ) ) ---- Server IP: 87.106.1.137 Probable Submitter: 188.193.188.222 ---- Manual Page -- http://www.php.net/manual/en/function.get-defined-functions.php Edit -- https://master.php.net/note/edit/108247 Del: integrated -- https://master.php.net/note/delete/108247/integrated Del: useless -- https://master.php.net/note/delete/108247/useless Del: bad code -- https://master.php.net/note/delete/108247/bad+code Del: spam -- https://master.php.net/note/delete/108247/spam Del: non-english -- https://master.php.net/note/delete/108247/non-english Del: in docs -- https://master.php.net/note/delete/108247/in+docs Del: other reasons-- https://master.php.net/note/delete/108247 Reject -- https://master.php.net/note/reject/108247 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#187057) next »