PHP4の環境を少しだけ助けてくれるモジュール

プログラミング
MasteringPHP 4.1

Advent Calendarのネタにしようかと思ったけどやめたネタです(´з`)y-~

今更すぎるネタ、PHP4の環境を出来るだけ苦にしない為に使える2つのモジュールを紹介します

1.PHP_Compat

使えるようになるFunction

array_change_key_case() PHP 4.2.0
array_chunk() PHP 4.2.0
array_combine() PHP 5.0.0
array_diff_assoc() PHP 4.3.0
array_diff_key() PHP 5.0.2
array_diff_ukey() PHP 5.0.2
array_intersect_assoc() PHP 5.0.0
array_intersect_key() PHP 5.0.2
array_intersect_uassoc() PHP 5.0.0
array_intersect_ukey() PHP 5.0.2
array_key_exists() PHP 4.1.0
array_product() PHP 5.1.0
array_search() PHP 4.0.5
array_udiff() PHP 5.0.0
array_udiff_assoc() PHP 5.0.0
array_udiff_uassoc() PHP 5.0.0
array_uintersect() PHP 5.0.0
array_uintersect_assoc() PHP 5.0.0
array_uintersect_uassoc() PHP 5.0.0
array_walk_recursive() PHP 5.0.0
call_user_func_array() PHP 4.0.4
bcinvert() PHP 5.2.0
bcpowmod() PHP 5.0.0
clone() PHP 5.0.0
constant() PHP 4.0.4
convert_uudecode() PHP 5.0.0
convert_uuencode() PHP 5.0.0
debug_print_backtrace() PHP 5.0.0
file_get_contents() PHP 4.3.0
file_put_contents() PHP 5.0.0
floatval() PHP 4.2.0
fprintf() PHP 5.0.0
fputcsv() PHP 5.0.0
get_headers() PHP 5.0.0
get_include_path() PHP 4.3.0
html_entity_decode() PHP 4.3.0
htmlspecialchars_decode() PHP 5.1.0
http_build_query() PHP 5.0.0
ibase_timefmt() PHP 5.0.0
idate() PHP 5.1.0
image_type_to_mime_type() PHP 4.3.0
inet_ntop() PHP 5.1.0
inet_pton() PHP 5.1.0
ini_get_all() PHP 4.2.0
is_a() PHP 4.2.0
is_scalar() PHP 4.0.5
md5_file() PHP 4.2.0
mhash() PHP 4.1.0
mime_content_type() PHP 4.3.0
ob_clean() PHP 4.2.0
ob_flush() PHP 4.2.0
ob_get_clean() PHP 4.3.0
ob_get_flush() PHP 4.3.0
php_strip_whitespace() PHP 5.0.0
property_exists() PHP 5.1.0
pg_affected_rows() PHP 4.2.0
pg_escape_bytea() PHP 4.2.0
pg_unescape_bytea() PHP 4.2.0
restore_include_path() PHP 4.3.0
scandir() PHP 5.0.0
set_include_path() PHP 4.3.0
str_ireplace() PHP 5.0.0
str_rot13() PHP 4.2.0
str_shuffle() PHP 4.3.0
str_split() PHP 5.0.0
str_word_count() PHP 4.3.0
stripos() PHP 5.0.0
strpbrk() PHP 5.0.0
strripos() PHP 5.0.0
substr_compare() PHP 5.0.0
time_sleep_until() PHP 5.1.0
var_export() PHP 4.2.0
version_compare() PHP 4.1.0
vprintf() PHP 4.1.0
vsprintf() PHP 4.1.0

その他、PHP_EOLなどの定数も使えます

使い方

~~~
2.upgrade.php

使えるようになるFunction

json_encode
json_decode
preg_filter
lcfirst
array_replace
strptime
error_get_last
preg_last_error
lchown
lchgrp
gzdecode
ob_get_headers
xmlentities
stripos
strripos
str_ireplace
get_headers
headers_list
fprintf
vfprintf
str_split
http_build_query
convert_uuencode
convert_uudecode
scandir
idate
time_nanosleep
strpbrk
php_real_logo_guid
php_egg_logo_guid
php_strip_whitespace
php_check_syntax
get_declared_interfaces
array_combine
array_walk_recursive
substr_compare
spl_classes
class_parents
session_commit
dns_check_record
dns_get_mx
setrawcookie
file_put_contents
file_get_contents
fnmatch
glob
array_key_exists
array_intersect_assoc
array_diff_assoc
html_entity_decode
str_word_count
str_shuffle
get_include_path
set_include_path
restore_include_path
str_rot13
array_change_key_case
array_fill
array_chunk
md5_file
is_a
fmod
floatval
is_infinite
is_nan
is_finite
var_export
strcoll
diskfreespace
disktotalspace
vprintf
vsprintf
import_request_variables
hypot
log1p
expm1
sinh
cosh
tanh
asinh
acosh
atanh
array_udiff_uassoc
array_udiff_assoc
array_diff_uassoc
array_udiff
array_uintersect_uassoc
array_uintersect_assoc
array_uintersect
array_intersect_uassoc
mime_content_type
image_type_to_mime_type
image_type_to_extension
exif_imagetype
array_filter
array_map
is_callable
array_search
array_reduce
is_scalar
localeconv
call_user_func_array
call_user_method_array
array_sum
constant
is_null
pathinfo
escapeshellarg
is_uploaded_file
move_uploaded_file
strncasecmp
wordwrap
php_uname
php_sapi_name

使い方

~~~
if (PHP_VERSION < 5.1) { include_once("upgrade.php"); } ~~~ どちらも基本的には呼ぶだけで使えるのがいいところです file_get_contentsやjson_decodeが使えないPHPなんて、、、というかたは是非使うといいかと思います また、本来の使い方的には、EC-CUBEの様なPHP4にも対応しないといけないオープンソースなどで使うとストレスも減りますしコミッター離れも起きないんじゃないかと思いました

コメント

タイトルとURLをコピーしました