Skip to content

Instantly share code, notes, and snippets.

@co3k
Created March 5, 2012 10:30
Show Gist options
  • Save co3k/1977785 to your computer and use it in GitHub Desktop.
Save co3k/1977785 to your computer and use it in GitHub Desktop.
PHP の組み込み関数の引数で参照渡しを期待するものを列挙するやつ
<?php
/* this code is under Public Domain */
$functions = get_defined_functions();
foreach ($functions['internal'] as $f) {
$rf = new ReflectionFunction($f);
$params = $rf->getParameters();
$refs = array();
foreach ($params as $param) {
if ($param->isPassedByReference()) {
$refs[] = $param->getName();
}
}
if ($refs) {
$paramNames = array_map(function($v) {
return $v->getName();
}, $params);
echo $rf->getName().'('.implode(', ', $paramNames).') - '.implode(', ', $refs).PHP_EOL;
}
}
@co3k
Copy link
Author

co3k commented Mar 5, 2012

output in my local:

each(arr) - arr
ereg(pattern, string, registers) - registers
eregi(pattern, string, registers) - registers
openssl_pkey_export(key, out, passphrase, config_args) - out
openssl_x509_export(x509, out, notext) - out
openssl_pkcs12_export(x509, out, priv_key, pass, args) - out
openssl_pkcs12_read(PKCS12, certs, pass) - certs
openssl_csr_new(dn, privkey, configargs, extraattribs) - privkey
openssl_csr_export(csr, out, notext) - out
openssl_sign(data, signature, key, method) - signature
openssl_seal(data, sealdata, ekeys, pubkeys) - sealdata, ekeys
openssl_open(data, opendata, ekey, privkey) - opendata
openssl_private_encrypt(data, crypted, key, padding) - crypted
openssl_private_decrypt(data, crypted, key, padding) - crypted
openssl_public_encrypt(data, crypted, key, padding) - crypted
openssl_public_decrypt(data, crypted, key, padding) - crypted
openssl_random_pseudo_bytes(length, result_is_strong) - result_is_strong
preg_match(pattern, subject, subpatterns, flags, offset) - subpatterns
preg_match_all(pattern, subject, subpatterns, flags, offset) - subpatterns
preg_replace(regex, replace, subject, limit, count) - count
preg_replace_callback(regex, callback, subject, limit, count) - count
preg_filter(regex, replace, subject, limit, count) - count
curl_multi_exec(mh, still_running) - still_running
curl_multi_info_read(mh, msgs_in_queue) - msgs_in_queue
mb_parse_str(encoded_string, result) - result
mb_convert_variables(to, from, ...) - ...
mb_ereg(pattern, string, registers) - registers
mb_eregi(pattern, string, registers) - registers
mbereg(pattern, string, registers) - registers
mberegi(pattern, string, registers) - registers
sqlite_open(filename, mode, error_message) - error_message
sqlite_popen(filename, mode, error_message) - error_message
sqlite_query(query, db, result_type, error_message) - error_message
sqlite_exec(query, db, error_message) - error_message
sqlite_unbuffered_query(query, db, result_type, error_message) - error_message
sqlite_factory(filename, mode, error_message) - error_message
getimagesize(imagefile, info) - info
str_replace(search, replace, subject, replace_count) - replace_count
str_ireplace(search, replace, subject, replace_count) - replace_count
similar_text(str1, str2, percent) - percent
parse_str(encoded_string, result) - result
sscanf(str, format, ...) - ...
fscanf(stream, format, ...) - ...
exec(command, output, return_value) - output, return_value
system(command, return_value) - return_value
passthru(command, return_value) - return_value
proc_open(command, descriptorspec, pipes, cwd, env, other_options) - pipes
call_user_method(method_name, object, parameter, ...) - object
call_user_method_array(method_name, object, params) - object
headers_sent(file, line) - file, line
dns_get_mx(hostname, mxhosts, weight) - mxhosts, weight
getmxrr(hostname, mxhosts, weight) - mxhosts, weight
dns_get_record(hostname, type, authns, addtl) - authns, addtl
settype(var, type) - var
is_callable(var, syntax_only, callable_name) - callable_name
stream_select(read_streams, write_streams, except_streams, tv_sec, tv_usec) - read_streams, write_streams, except_streams
stream_socket_client(remoteaddress, errcode, errstring, timeout, flags, context) - errcode, errstring
stream_socket_server(localaddress, errcode, errstring, flags, context) - errcode, errstring
stream_socket_accept(serverstream, timeout, peername) - peername
stream_socket_recvfrom(stream, amount, flags, remote_addr) - remote_addr
flock(fp, operation, wouldblock) - wouldblock
fsockopen(hostname, port, errno, errstr, timeout) - errno, errstr
pfsockopen(hostname, port, errno, errstr, timeout) - errno, errstr
ksort(arg, sort_flags) - arg
krsort(arg, sort_flags) - arg
natsort(arg) - arg
natcasesort(arg) - arg
asort(arg, sort_flags) - arg
arsort(arg, sort_flags) - arg
sort(arg, sort_flags) - arg
rsort(arg, sort_flags) - arg
usort(arg, cmp_function) - arg
uasort(arg, cmp_function) - arg
uksort(arg, cmp_function) - arg
shuffle(arg) - arg
array_walk(input, funcname, userdata) - input
array_walk_recursive(input, funcname, userdata) - input
end(arg) - arg
prev(arg) - arg
next(arg) - arg
reset(arg) - arg
current(arg) - arg
key(arg) - arg
array_multisort(arr1, SORT_ASC_or_SORT_DESC, SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING, arr2, SORT_ASC_or_SORT_DESC, SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING) - arr1, SORT_ASC_or_SORT_DESC, SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING, arr2, SORT_ASC_or_SORT_DESC, SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING
array_push(stack, var, ...) - stack
array_pop(stack) - stack
array_shift(stack) - stack
array_unshift(stack, var, ...) - stack
array_splice(arg, offset, length, replacement) - arg
pos(arg) - arg
xml_set_object(parser, obj) - obj
xml_parse_into_struct(parser, data, values, index) - values, index
apc_fetch(key, success) - success
apc_inc(key, step, success) - success
apc_dec(key, step, success) - success
extract(arg, extract_type, prefix) - arg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment