diff --git a/README.md b/README.md index 163a2ae..7cf07be 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Userland implementation of [PHP RFC: Consistent Function Names](https://wiki.php.net/rfc/consistent_function_names). It creates aliases with more consistent names. -There are many functions that named before naming standard in [CODING_STANDARDS](https://github.com/php/php-src/blob/master/CODING_STANDARDS). +There are many functions that named before naming standard in [CODING_STANDARDS](https://github.com/php/php-src/blob/master/CODING_STANDARDS.md). Therefore, PHP has function names like `phpversion()` and `htmlspecialchars()`. We have many function names that comply [IEEE 1003.1](http://pubs.opengroup.org/onlinepubs/9699919799/idx/is.html) @@ -18,522 +18,650 @@ Please read the RCF for more information: https://wiki.php.net/rfc/consistent_fu ## Installation - composer require jasny/php-consistent-function-names + composer require jasny/consistent-function-names ## Functions ### Functions other than Standard module - -- bc_add ← bcadd -- bc_comp ← bccomp -- bc_div ← bcdiv -- bc_mod ← bcmod -- bc_mul ← bcmul -- bc_pow ← bcpow -- bc_pow_mod ← bcpowmod -- bc_scale ← bcscale -- bc_sqrt ← bcsqrt -- bc_sub ← bcsub - - -- gettext_bind_text_domain_codeset ← bind_textdomain_codeset -- gettext_bind_text_domain ← bindtextdomain -- **gettext_dc** ← dcgettext -- **gettext_dcn** ← dcngettext -- **gettext_d** ← dgettext -- **gettext_dn** ← dngettext -- **gettext_n** ← ngettext -- gettext_text_domain ← textdomain - - -- bz_close ← bzclose -- bz_compress ← bzcompress -- bz_decompress ← bzdecompress -- bz_errno ← bzerrno -- bz_error ← bzerror -- bz_errstr ← bzerrstr -- bz_flush ← bzflush -- bz_open ← bzopen -- bz_read ← bzread -- bz_write ← bzwrite - - -- gz_close ← gzclose -- gz_compress ← gzcompress -- gz_decode ← gzdecode -- gz_deflate ← gzdeflate -- gz_encode ← gzencode -- gz_eof ← gzeof -- gz_file ← gzfile -- gz_getc ← gzgetc -- gz_gets ← gzgets -- gz_getss ← gzgetss -- gz_inflate ← gzinflate -- gz_open ← gzopen -- gz_passthru ← gzpassthru -- gz_puts ← gzputs -- gz_read ← gzread -- gz_rewind ← gzrewind -- gz_seek ← gzseek -- gz_tell ← gztell -- gz_uncompress ← gzuncompress -- gz_write ← gzwrite -- **gz_read_file** ← readgzfile - - -- **gd_image_size** ← getimagesize -- **gd_image_size_from_string** ← getimagesizefromstring -- gd_type_to_extension ← image_type_to_extension -- gd_type_to_mime_type ← image_type_to_mime_type -- gd_2wbmp ← image2wbmp -- gd_affine ← imageaffine -- gd_affine_matrix_concat ← imageaffinematrixconcat -- gd_affine_matrix_get ← imageaffinematrixget -- gd_alpha_blending ← imagealphablending -- gd_antialias ← imageantialias -- gd_arc ← imagearc -- gd_char ← imagechar -- gd_charup ← imagecharup -- gd_color_allocate ← imagecolorallocate -- gd_color_allocate_alpha ← imagecolorallocatealpha -- gd_color_at ← imagecolorat -- gd_color_closest ← imagecolorclosest -- gd_color_closest_alpha ← imagecolorclosestalpha -- gd_color_closest_hwb ← imagecolorclosesthwb -- gd_color_deallocate ← imagecolordeallocate -- gd_color_exact ← imagecolorexact -- gd_color_exact_alpha ← imagecolorexactalpha -- gd_color_match ← imagecolormatch -- gd_color_resolve ← imagecolorresolve -- gd_color_resolve_alpha ← imagecolorresolvealpha -- gd_color_set ← imagecolorset -- gd_colors_for_index ← imagecolorsforindex -- gd_colors_total ← imagecolorstotal -- gd_color_transparent ← imagecolortransparent -- gd_convolution ← imageconvolution -- gd_copy ← imagecopy -- gd_copy_merge ← imagecopymerge -- gd_copy_merge_gray ← imagecopymergegray -- gd_copy_resampled ← imagecopyresampled -- gd_copy_resized ← imagecopyresized -- gd_create ← imagecreate -- gd_create_from_gd2 ← imagecreatefromgd2 -- gd_create_from_gd2_part ← imagecreatefromgd2part -- gd_create_from_gd ← imagecreatefromgd -- gd_create_from_gif ← imagecreatefromgif -- gd_create_from_jpeg ← imagecreatefromjpeg -- gd_create_from_png ← imagecreatefrompng -- gd_create_from_string ← imagecreatefromstring -- gd_create_from_wbmp ← imagecreatefromwbmp -- gd_create_from_webp ← imagecreatefromwebp -- gd_create_from_xbm ← imagecreatefromxbm -- gd_create_from_xpm ← imagecreatefromxpm -- gd_create_true_color ← imagecreatetruecolor -- gd_crop ← imagecrop -- gd_crop_auto ← imagecropauto -- gd_dashed_line ← imagedashedline -- gd_destroy ← imagedestroy -- gd_ellipse ← imageellipse -- gd_fill ← imagefill -- gd_filled_arc ← imagefilledarc -- gd_filled_ellipse ← imagefilledellipse -- gd_filled_polygon ← imagefilledpolygon -- gd_filled_rectangle ← imagefilledrectangle -- gd_fill_to_border ← imagefilltoborder -- gd_filter ← imagefilter -- gd_flip ← imageflip -- gd_font_height ← imagefontheight -- gd_font_width ← imagefontwidth -- gd_ft_bbox ← imageftbbox -- gd_ft_text ← imagefttext -- gd_gamma_correct ← imagegammacorrect -- gd_raw2 ← imagegd2 -- gd_raw ← imagegd -- gd_gif ← imagegif -- gd_grab_screen ← imagegrabscreen -- gd_grab_window ← imagegrabwindow -- gd_interlace ← imageinterlace -- gd_is_true_color ← imageistruecolor -- gd_jpeg ← imagejpeg -- gd_layer_effect ← imagelayereffect -- gd_line ← imageline -- gd_load_font ← imageloadfont -- gd_palette_copy ← imagepalettecopy -- gd_palette_to_true_color ← imagepalettetotruecolor -- gd_png ← imagepng -- gd_polygon ← imagepolygon -- gd_ps_bbox ← imagepsbbox -- gd_ps_encode_font ← imagepsencodefont -- gd_ps_extend_font ← imagepsextendfont -- gd_ps_free_font ← imagepsfreefont -- gd_ps_load_font ← imagepsloadfont -- gd_ps_slant_font ← imagepsslantfont -- gd_ps_text ← imagepstext -- gd_rectangle ← imagerectangle -- gd_rotate ← imagerotate -- gd_save_alpha ← imagesavealpha -- gd_scale ← imagescale -- gd_set_brush ← imagesetbrush -- gd_set_interpolation ← imagesetinterpolation -- gd_set_pixel ← imagesetpixel -- gd_set_style ← imagesetstyle -- gd_set_thickness ← imagesetthickness -- gd_set_tile ← imagesettile -- gd_string ← imagestring -- gd_string_up ← imagestringup -- **gd_width** ← imagesx -- **gd_height** ← imagesy -- gd_true_color_to_palette ← imagetruecolortopalette -- gd_ttf_bbox ← imagettfbbox -- gd_ttf_text ← imagettftext -- gd_types ← imagetypes -- gd_wbmp ← imagewbmp -- gd_webp ← imagewebp -- gd_xbm ← imagexbm -- gd_iptc_embed ← iptcembed -- gd_iptc_parse ← iptcparse -- gd_jpeg2wbmp ← jpeg2wbmp -- gd_png2wbmp ← png2wbmp - - -- exif_image_type ← exif_imagetype -- exif_tag_name ← exif_tagname - - -- ctype modules functions are IEEE functions. Add "ctype_" prefixed IEEE aliases. -- ctype_alnum ← **ctype_isalnum** (IEEE) -- ctype_alpha ← **ctype_isalpha** (IEEE) -- ctype_cntrl ← **ctype_iscntrl** (IEEE) -- ctype_digit ← **ctype_isdigit** (IEEE) -- ctype_graph ← **ctype_isgraph** (IEEE) -- ctype_lower ← **ctype_islower** (IEEE) -- ctype_print ← **ctype_isprint** (IEEE) -- ctype_punct ← **ctype_ispunct** (IEEE) -- ctype_space ← **ctype_isspace** (IEEE) -- ctype_upper ← **ctype_isupper** (IEEE) -- ctype_xdigit ← **ctype_isxdigit** (IEEE) - - -- mb_decode_mime_header ← mb_decode_mimeheader -- mb_decode_numeric_entity ← mb_decode_numericentity -- mb_encode_mime_header ← mb_encode_mimeheader -- mb_encode_numeric_entity ← mb_encode_numericentity -- **mb_mail** ← mb_send_mail (There is mail() as standard function) + + +New | Old | Comment +--- | --- | --- +bc_add | bcadd | +bc_comp | bccomp | +bc_div | bcdiv | +bc_mod | bcmod | +bc_mul | bcmul | +bc_pow | bcpow | +bc_pow_mod | bcpowmod | +bc_scale | bcscale | +bc_sqrt | bcsqrt | +bc_sub | bcsub | + + + +New | Old | Comment +--- | --- | --- +gettext_bind_text_domain_codeset | bind_textdomain_codeset | +gettext_bind_text_domain | bindtextdomain | +**gettext_dc** | dcgettext | +**gettext_dcn** | dcngettext | +**gettext_d** | dgettext | +**gettext_dn** | dngettext | +**gettext_n** | ngettext | +gettext_text_domain | textdomain | + + + +New | Old | Comment +--- | --- | --- +bz_close | bzclose | +bz_compress | bzcompress | +bz_decompress | bzdecompress | +bz_errno | bzerrno | +bz_error | bzerror | +bz_errstr | bzerrstr | +bz_flush | bzflush | +bz_open | bzopen | +bz_read | bzread | +bz_write | bzwrite | + + + +New | Old | Comment +--- | --- | --- +gz_close | gzclose | +gz_compress | gzcompress | +gz_decode | gzdecode | +gz_deflate | gzdeflate | +gz_encode | gzencode | +gz_eof | gzeof | +gz_file | gzfile | +gz_getc | gzgetc | +gz_gets | gzgets | +gz_getss | gzgetss | +gz_inflate | gzinflate | +gz_open | gzopen | +gz_passthru | gzpassthru | +gz_puts | gzputs | +gz_read | gzread | +gz_rewind | gzrewind | +gz_seek | gzseek | +gz_tell | gztell | +gz_uncompress | gzuncompress | +gz_write | gzwrite | +**gz_read_file** | readgzfile | + + + +New | Old | Comment +--- | --- | --- +**gd_image_size** | getimagesize | +**gd_image_size_from_string** | getimagesizefromstring | +gd_type_to_extension | image_type_to_extension | +gd_type_to_mime_type | image_type_to_mime_type | +gd_2wbmp | image2wbmp | +gd_affine | imageaffine | +gd_affine_matrix_concat | imageaffinematrixconcat | +gd_affine_matrix_get | imageaffinematrixget | +gd_alpha_blending | imagealphablending | +gd_antialias | imageantialias | +gd_arc | imagearc | +gd_char | imagechar | +gd_charup | imagecharup | +gd_color_allocate | imagecolorallocate | +gd_color_allocate_alpha | imagecolorallocatealpha | +gd_color_at | imagecolorat | +gd_color_closest | imagecolorclosest | +gd_color_closest_alpha | imagecolorclosestalpha | +gd_color_closest_hwb | imagecolorclosesthwb | +gd_color_deallocate | imagecolordeallocate | +gd_color_exact | imagecolorexact | +gd_color_exact_alpha | imagecolorexactalpha | +gd_color_match | imagecolormatch | +gd_color_resolve | imagecolorresolve | +gd_color_resolve_alpha | imagecolorresolvealpha | +gd_color_set | imagecolorset | +gd_colors_for_index | imagecolorsforindex | +gd_colors_total | imagecolorstotal | +gd_color_transparent | imagecolortransparent | +gd_convolution | imageconvolution | +gd_copy | imagecopy | +gd_copy_merge | imagecopymerge | +gd_copy_merge_gray | imagecopymergegray | +gd_copy_resampled | imagecopyresampled | +gd_copy_resized | imagecopyresized | +gd_create | imagecreate | +gd_create_from_gd2 | imagecreatefromgd2 | +gd_create_from_gd2_part | imagecreatefromgd2part | +gd_create_from_gd | imagecreatefromgd | +gd_create_from_gif | imagecreatefromgif | +gd_create_from_jpeg | imagecreatefromjpeg | +gd_create_from_png | imagecreatefrompng | +gd_create_from_string | imagecreatefromstring | +gd_create_from_wbmp | imagecreatefromwbmp | +gd_create_from_webp | imagecreatefromwebp | +gd_create_from_xbm | imagecreatefromxbm | +gd_create_from_xpm | imagecreatefromxpm | +gd_create_true_color | imagecreatetruecolor | +gd_crop | imagecrop | +gd_crop_auto | imagecropauto | +gd_dashed_line | imagedashedline | +gd_destroy | imagedestroy | +gd_ellipse | imageellipse | +gd_fill | imagefill | +gd_filled_arc | imagefilledarc | +gd_filled_ellipse | imagefilledellipse | +gd_filled_polygon | imagefilledpolygon | +gd_filled_rectangle | imagefilledrectangle | +gd_fill_to_border | imagefilltoborder | +gd_filter | imagefilter | +gd_flip | imageflip | +gd_font_height | imagefontheight | +gd_font_width | imagefontwidth | +gd_ft_bbox | imageftbbox | +gd_ft_text | imagefttext | +gd_gamma_correct | imagegammacorrect | +gd_raw2 | imagegd2 | +gd_raw | imagegd | +gd_gif | imagegif | +gd_grab_screen | imagegrabscreen | +gd_grab_window | imagegrabwindow | +gd_interlace | imageinterlace | +gd_is_true_color | imageistruecolor | +gd_jpeg | imagejpeg | +gd_layer_effect | imagelayereffect | +gd_line | imageline | +gd_load_font | imageloadfont | +gd_palette_copy | imagepalettecopy | +gd_palette_to_true_color | imagepalettetotruecolor | +gd_png | imagepng | +gd_polygon | imagepolygon | +gd_ps_bbox | imagepsbbox | +gd_ps_encode_font | imagepsencodefont | +gd_ps_extend_font | imagepsextendfont | +gd_ps_free_font | imagepsfreefont | +gd_ps_load_font | imagepsloadfont | +gd_ps_slant_font | imagepsslantfont | +gd_ps_text | imagepstext | +gd_rectangle | imagerectangle | +gd_rotate | imagerotate | +gd_save_alpha | imagesavealpha | +gd_scale | imagescale | +gd_set_brush | imagesetbrush | +gd_set_interpolation | imagesetinterpolation | +gd_set_pixel | imagesetpixel | +gd_set_style | imagesetstyle | +gd_set_thickness | imagesetthickness | +gd_set_tile | imagesettile | +gd_string | imagestring | +gd_string_up | imagestringup | +**gd_width** | imagesx | +**gd_height** | imagesy | +gd_true_color_to_palette | imagetruecolortopalette | +gd_ttf_bbox | imagettfbbox | +gd_ttf_text | imagettftext | +gd_types | imagetypes | +gd_wbmp | imagewbmp | +gd_webp | imagewebp | +gd_xbm | imagexbm | +gd_iptc_embed | iptcembed | +gd_iptc_parse | iptcparse | +gd_jpeg2wbmp | jpeg2wbmp | +gd_png2wbmp | png2wbmp | + + + +New | Old | Comment +--- | --- | --- +exif_image_type | exif_imagetype | +exif_tag_name | exif_tagname | + + + +ctype modules functions are IEEE functions. Add "ctype_" prefixed IEEE aliases. + +New | Old | Comment +--- | --- | --- +ctype_alnum |  **ctype_isalnum**  | IEEE +ctype_alpha |  **ctype_isalpha**  | IEEE +ctype_cntrl |  **ctype_iscntrl**  | IEEE +ctype_digit |  **ctype_isdigit**  | IEEE +ctype_graph |  **ctype_isgraph**  | IEEE +ctype_lower |  **ctype_islower**  | IEEE +ctype_print |  **ctype_isprint**  | IEEE +ctype_punct |  **ctype_ispunct**  | IEEE +ctype_space |  **ctype_isspace**  | IEEE +ctype_upper |  **ctype_isupper**  | IEEE +ctype_xdigit |  **ctype_isxdigit**  | IEEE + + + +New | Old | Comment +--- | --- | --- +mb_decode_mime_header | mb_decode_mimeheader | +mb_decode_numeric_entity | mb_decode_numericentity | +mb_encode_mime_header | mb_encode_mimeheader | +mb_encode_numeric_entity | mb_encode_numericentity | +**mb_mail** | mb_send_mail | There is mail() as standard function ### Socket Functions - -- IEEE names are prefixed by "socket_". -- socket_get_peer_name ← socket_getpeername (IEEE) -- socket_get_sock_name ← socket_getsockname (IEEE) -- socket_recv_from ← socket_recvfrom (IEEE) -- socket_recv_msg ← socket_recvmsg (IEEE) -- socket_send_msg ← socket_sendmsg (IEEE) -- socket_send_to ← socket_sendto (IEEE) -- **socket_errstr** ← socket_strerror (**need more consideration. strerror() is IEEE name** Adjust to accord with other names. errstr/errno abbreviations are used by various functions/classes. e.g. bz_errstr(), MySQLi::$errno.) - - -- **sapi_request_headers** ← getallheaders (Categorized as apache function, but available for CLI and FCGI also) -- **apache_virtual** ← virtual -- apache_get_env ← apache_getenv -- apache_set_env ← apache_setenv + + + +IEEE names are prefixed by "socket_" + +New | Old | Comment +--- | --- | --- +socket_get_peer_name | socket_getpeername | IEEE +socket_get_sock_name | socket_getsockname | IEEE +socket_recv_from | socket_recvfrom | IEEE +socket_recv_msg | socket_recvmsg | IEEE +socket_send_msg | socket_sendmsg | IEEE +socket_send_to | socket_sendto | IEEE +**socket_errstr**  | socket_strerror | **need more consideration. strerror() is IEEE name** Adjust to accord with other names. errstr/errno abbreviations are used by various functions/classes. e.g. bz_errstr(), MySQLi::$errno. + + + +New | Old | Comment +--- | --- | --- +**sapi_request_headers** | getallheaders | Categorized as apache function, but available for CLI and FCGI also +**apache_virtual** | virtual | +apache_get_env | apache_getenv | +apache_set_env | apache_setenv | ### Date/Time Functions - -- **date_format** ← date (Return formatted date string of timestamp)(IEEE) -- **date_get** ← getdate (Return array date)(IEEE) -- **date_check** ← checkdate -- **time_part** ← idate (Retrieve part of date information as int according to format) -- **time_make** ← mktime (Return timestamp from number of int parameters)(IEEE) -- **time_format** ← strftime (Return local time string according to format/locale)(IEEE) -- **time_utc** ← gmdate (Return array GMT/UTC timestamp) -- **time_utc_make** ← gmmktime (Return GMT/UTC timestamp from array) -- **time_utc_format** ← gmstrftime (Return GMT/UTC time string according to format/locale) -- **time_get** ← gettimeofday (Return array time of day)(IEEE) -- **time_local** ← localtime (Return localtime() result array. More info than time_get/gettimeofday)(IEEE) -- **time_micro** ← microtime (Return microtime resolution time)(IEEE) -- **time_parse** ← strptime (Parse time string generated by time_format/strftime. Return timestamp) (IEEE) -- **time_from_string** ← strtotime (Parse string time and return timestamp. Return timestamp) + + + +New | Old | Comment +--- | --- | --- +**date_format** | date | (Return formatted date string of timestamp)(IEEE) +**date_get** | getdate | (Return array date)(IEEE) +**date_check** | checkdate | +**time_part** | idate | (Retrieve part of date information as int according to format) +**time_make** | mktime | (Return timestamp from number of int parameters)(IEEE) +**time_format** | strftime | (Return local time string according to format/locale)(IEEE) +**time_utc** | gmdate | (Return array GMT/UTC timestamp) +**time_utc_make** | gmmktime | (Return GMT/UTC timestamp from array) +**time_utc_format** | gmstrftime | (Return GMT/UTC time string according to format/locale) +**time_get** | gettimeofday | (Return array time of day)(IEEE) +**time_local** | localtime | (Return localtime() result array. More info than time_get/gettimeofday)(IEEE) +**time_micro** | microtime | (Return microtime resolution time)(IEEE) +**time_parse** | strptime | (Parse time string generated by time_format/strftime. Return timestamp) (IEEE) +**time_from_string**  | strtotime | (Parse string time and return timestamp. Return timestamp) ### Directory Related Functions + Directory related : Prefixed by "dir_" It's supposed to be named as "dir module". Note: These functions changes "directory entry" information. -- dir_rename ← rename (Rename is actually a directory operation. e.g File deletion/rename is controlled by current dir permission)(IEEE) -- **dir_delete** ← rmdir (IEEE) -- **dir_create** ← mkdir (IEEE) -- dir_chown← chown (IEEE) -- dir_chmod ← chmod (IEEE) -- dir_chgrp ← chgrp(IEEE) -- dir_name ← dirname (IEEE) -- dir_glob ← glob (IEEE) - - -- **dir_set** ← chdir(IEEE) -- dir_chroot ← chroot (IEEE) -- **dir_get** ← getcwd(IEEE) -- **dir_open** ← opendir (IEEE) -- **dir_close** ← closedir (IEEE) -- **dir_read** ← readdir(IEEE) -- **dir_rewind** ← rewinddir(IEEE) -- **dir_scan** ← scandir (IEEE) + +New | Old | Comment +--- | --- | --- +dir_rename | rename| Rename is actually a directory operation. e.g File deletion/rename is controlled by current dir permission (IEEE) +**dir_delete** | rmdir | IEEE +**dir_create** | mkdir | IEEE +dir_chown | chown | IEEE +dir_chmod | chmod | IEEE +dir_chgrp | chgrp | IEEE +dir_name | dirname | IEEE +dir_glob | glob | IEEE + + + +New | Old | Comment +--- | --- | --- +**dir_set** | chdir | IEEE +dir_chroot | chroot | IEEE +**dir_get** | getcwd | IEEE +**dir_open** | opendir | IEEE +**dir_close** | closedir | IEEE +**dir_read** | readdir | IEEE +**dir_rewind** | rewinddir | IEEE +**dir_scan** | scandir | IEEE ### Function Handling Functions - - All of function handling functions are prefixed by "function_" by these. -- **function_declared** ← get_defined_functions (There are get_defined_constants()/get_defined_vars(), but class/interface/trait use get_declared_classes/interfaces/traits()) -- **function_create** ← create_function (There is function_exists()) -- **function_arg** ← func_get_arg -- **function_args** ← func_get_args -- function_num_args ← func_num_args -- **function_call_user** ← call_user_func -- **function_call_user_array** ← call_user_func_array -- **function_shutdown_register** ← register_shutdown_function -- **function_tick_register** ← register_tick_function -- **function_tick_unregister** ← unregister_tick_function -- **function_static_call_array** ← forward_static_call_array -- **function_static_call** ← forward_static_call + +  + +All of function handling functions are prefixed by "function_" by these. + +New | Old | Comment +--- | --- | --- +**function_declared** | get_defined_functions | There are get_defined_constants()/get_defined_vars(), but class/interface/trait use get_declared_classes/interfaces/traits() +**function_create** | create_function | There is function_exists() +**function_arg** | func_get_arg | +**function_args** | func_get_args | +function_num_args | func_num_args | +**function_call_user** | call_user_func | +**function_call_user_array** | call_user_func_array | +**function_shutdown_register** | register_shutdown_function | +**function_tick_register** | register_tick_function | +**function_tick_unregister** | unregister_tick_function | +**function_static_call_array** | forward_static_call_array | +**function_static_call** | forward_static_call | ### Command Execution Functions - -- **exec_passthru** ← passthru (Named after exec()) -- **exec_shell** ← shell_exec -- **exec_system** ← system (IEEE) -- **exec_escape_arg** ← escapeshellarg -- **exec_escape_cmd** ← escapeshellcmd + + + +New | Old | Comment +--- | --- | --- +**exec_passthru** | passthru | Named after exec() +**exec_shell** | shell_exec | +**exec_system** | system | IEEE +**exec_escape_arg** | escapeshellarg | +**exec_escape_cmd** | escapeshellcmd | ### String Related Functions + + HTML related: -- html_entities ← htmlentities -- **html_escape** ← htmlspecialchars (Rename it with real meaning) -- **html_escape_decode** ← htmlspecialchars_decode -- **html_nl2br** ← nl2br -- **html_strip_tags** ← strip_tags -- **html_translation_table** ← get_html_translation_table + +New | Old | Comment +--- | --- | --- +html_entities | htmlentities | +**html_escape** | htmlspecialchars | Rename it with real meaning +**html_escape_decode** | htmlspecialchars_decode | +**html_nl2br** | nl2br | +**html_strip_tags** | strip_tags | +**html_translation_table** | get_html_translation_table | Locate related: -- locale_conv ← localeconv (IEEE) -- **locale_set** ← setlocale (IEEE) -- **locale_info** ← nl_langinfo (IEEE) + +New | Old | Comment +--- | --- | --- +locale_conv | localeconv | IEEE +**locale_set** | setlocale | IEEE +**locale_info** | nl_langinfo | IEEE "string" function but no "str_" prefix -- **str_cslashes** ← addcslashes -- **str_cslashes_strip** ← stripcslashes -- **str_slashes** ← addslashes -- **str_slashes_strip** ← stripslashes -- str_chop ← chop -- str_count_chars ← count_chars -- str_chunk_split ← chunk_split -- str_explode ← explode -- str_implode ← implode -- str_money_format ← money_format -- str_number_format ← number_format -- str_levenshtein ← levenshtein -- str_metaphone ← metaphone -- **str_parse** ← parse_str -- str_quote_meta ← quotemeta -- str_similar_text ← similar_text -- str_soundex ← soundex -- str_sscanf ← sscanf (IEEE) -- str_rtrim ← rtrim -- str_trim ← trim -- str_ltrim ← ltrim -- str_lc_first ← lcfirst -- str_uc_first ← ucfirst -- str_uc_words ← ucwords -- str_word_wrap ← wordwrap + +New | Old | Comment +--- | --- | --- +**str_cslashes** | addcslashes | +**str_cslashes_strip** | stripcslashes | +**str_slashes** | addslashes | +**str_slashes_strip** | stripslashes | +str_chop | chop | +str_count_chars | count_chars | +str_chunk_split | chunk_split | +str_explode | explode | +str_implode | implode | +str_money_format | money_format | +str_number_format | number_format | +str_levenshtein | levenshtein | +str_metaphone | metaphone | +**str_parse** | parse_str | +str_quote_meta | quotemeta | +str_similar_text | similar_text | +str_soundex | soundex | +str_sscanf | sscanf | IEEE +str_rtrim | rtrim | +str_trim | trim | +str_ltrim | ltrim | +str_lc_first | lcfirst | +str_uc_first | ucfirst | +str_uc_words | ucwords | +str_word_wrap | wordwrap | Comparison: -- str_cmp ← strcmp (IEEE) -- str_ncmp ← strncmp (IEEE) -- str_case_cmp ← strcasecmp (IEEE) -- str_ncase_cmp ← strncasecmp (IEEE) -- str_nat_cmp ← strnatcmp (IEEE) -- str_nat_case_cmp ← strnatcasecmp (IEEE) + +New | Old | Comment +--- | --- | --- +str_cmp | strcmp | IEEE +str_ncmp | strncmp | IEEE +str_case_cmp | strcasecmp | IEEE +str_ncase_cmp | strncasecmp | IEEE +str_nat_cmp | strnatcmp | IEEE +str_nat_case_cmp | strnatcasecmp | IEEE Conversion: -- str_to_lower ← strtolower, **tolower** (IEEE) -- str_to_upper ← strtoupper, **toupper** (IEEE) + +New | Old | Comment +--- | --- | --- +str_to_lower | strtolower, **tolower**  | IEEE +str_to_upper | strtoupper, **toupper**  | IEEE Misc: -- str_get_csv ← str_getcsv + +New | Old | Comment +--- | --- | --- +str_get_csv | str_getcsv | Named after libc: -- str_chr ← strchr (IEEE) -- str_cmp ← strcmp (IEEE) -- str_coll ← strcoll (IEEE) -- str_cspn ← strcspn (IEEE) -- str_ipos ← stripos -- str_istr ← stristr -- str_len ← strlen (IEEE) -- str_pbrk ← strpbrk (IEEE) -- str_pos ← strpos -- str_rchr ← strrchr -- str_rev ← strrev -- str_ripos ← strripos -- str_rpos ← strrpos -- str_spn ← strspn (IEEE) -- str_str ← strstr (IEEE) -- str_tok ← strtok (IEEE) -- str_tr ← strtr - - + +New | Old | Comment +--- | --- | --- +str_chr | strchr | IEEE +str_cmp | strcmp | IEEE +str_coll | strcoll | IEEE +str_cspn | strcspn | IEEE +str_ipos | stripos | +str_istr | stristr | +str_len | strlen | IEEE +str_pbrk | strpbrk | IEEE +str_pos | strpos | +str_rchr | strrchr | +str_rev | strrev | +str_ripos | strripos | +str_rpos | strrpos | +str_spn | strspn | IEEE +str_str | strstr | IEEE +str_tok | strtok | IEEE +str_tr | strtr | + + + IEEE names are prefixed by "mb_" -- mb_str_cut ← mb_strcut -- **mb_str_trim_width** ← mb_strimwidth -- mb_str_ipos ← mb_stripos -- mb_str_istr ← mb_stristr -- mb_str_len ← mb_strlen (IEEE) -- mb_str_pos ← mb_strpos -- mb_str_rchr ← mb_strrchr -- mb_str_richr ← mb_strrichr -- mb_str_ripos ← mb_strripos -- mb_str_rpos ← mb_strrpos -- mb_str_str ← mb_strstr (IEEE) -- mb_str_to_lower ← mb_strtolower, **mb_tolower** (IEEE) -- mb_str_to_upper ← mb_strtoupper, **mb_toupper** (IEEE) -- mb_str_width ← mb_strwidth - - + +New | Old | Comment +--- | --- | --- +mb_str_cut | mb_strcut | +**mb_str_trim_width** | mb_strimwidth | +mb_str_ipos | mb_stripos | +mb_str_istr | mb_stristr | +mb_str_len | mb_strlen | IEEE +mb_str_pos | mb_strpos | +mb_str_rchr | mb_strrchr | +mb_str_richr | mb_strrichr | +mb_str_ripos | mb_strripos | +mb_str_rpos | mb_strrpos | +mb_str_str | mb_strstr | IEEE +mb_str_to_lower | mb_strtolower, **mb_tolower**  | IEEE +mb_str_to_upper | mb_strtoupper, **mb_toupper**  | IEEE +mb_str_width | mb_strwidth | + + + IEEE names are prefixed by "iconv_" -- iconv_str_len ← iconv_strlen (IEEE) -- iconv_str_pos ← iconv_strpos -- iconv_str_rpos ← iconv_strrpos - +New | Old | Comment +--- | --- | --- +iconv_str_len | iconv_strlen | IEEE +iconv_str_pos | iconv_strpos | +iconv_str_rpos | iconv_strrpos | + + + IEEE names are prefixed by "grapheme_" -- grapheme_str_ipos ← grapheme_stripos -- grapheme_str_istr ← grapheme_stristr -- grapheme_str_len ← grapheme_strlen (IEEE) -- grapheme_str_pos ← grapheme_strpos -- grapheme_str_ripos ← grapheme_strripos -- grapheme_str_rpos ← grapheme_strrpos -- grapheme_str_str ← grapheme_strstr (IEEE) + +New | Old | Comment +--- | --- | --- +grapheme_str_ipos | grapheme_stripos | +grapheme_str_istr | grapheme_stristr | +grapheme_str_len | grapheme_strlen | IEEE +grapheme_str_pos | grapheme_strpos | +grapheme_str_ripos | grapheme_strripos | +grapheme_str_rpos | grapheme_strrpos | +grapheme_str_str | grapheme_strstr | IEEE ### Array Related Functions - -- array_sort ← sort (Sort values) -- **array_sort_reverse** ← rsort (Reverse sort values) -- **array_usort** ← usort (User sort values) -- **array_sort_assoc** ← asort (Keep key and sort) -- **array_sort_assoc_reverse** ← arsort (Keep key and reverse sort) -- **array_sort_uassoc** ← uasort (Keep key and user sort) -- **array_sort_key** ← ksort (Sort keys) -- **array_sort_key_reverse** ← krsort (Reverse sort keys) -- **array_sort_ukey** ← uksort (User key sort) -- **array_sort_natural** ← natsort (Natural sort) -- **array_sort_natural_case** ← natcasesort (Natural sort without case) -- **array_in** ← in_array -- array_range ← range (Create array of range) -- array_shuffle ← shuffle (Randomize values) -- **array_in** ← bool in_array ( mixed $needle , array $haystack [, bool $strict ] ) -- **array_find** ← mixed array_search ( mixed $needle , array $haystack [, bool $strict ] -- **array_key_find** ← bool array_key_exists ( mixed $key , array $array ) + + +New | Old | Comment +--- | --- | --- +array_sort | sort | Sort values +**array_sort_reverse** | rsort | Reverse sort values +**array_usort** | usort | User sort values +**array_sort_assoc** | asort | Keep key and sort +**array_sort_assoc_reverse** | arsort | Keep key and reverse sort +**array_sort_uassoc** | uasort | Keep key and user sort +**array_sort_key** | ksort | Sort keys +**array_sort_key_reverse** | krsort | Reverse sort keys +**array_sort_ukey** | uksort | User key sort +**array_sort_natural** | natsort | Natural sort +**array_sort_natural_case** | natcasesort | Natural sort without case +**array_in** | in_array | +array_range | range | Create array of range +array_shuffle | shuffle | Randomize values +**array_find** | array_search | +**array_key_find** | array_key_exists | ### File Related Functions - -- link_info ← linkinfo -- **link_stat** ← lstat (IEEE) -- **link_chown** ← lchown (IEEE) -- **link_chgrp** ← lchgrp (IEEE) -- **link_read** ← readlink (IEEE) -- **link_symbolic** ← symlink (IEEE) -- **path_base_name** ← basename -- path_info ← pathinfo -- file_read ← readfile (This could be file_read() or file_passthru(). If rename fopen()/etc with "file_" prefix, file_read() may conflict with fread() file_passthru() may conflict with fpassthru().) -- **pipe_close** ← pclose (IEEE) -- **pipe_open** ← popen (IEEE) -- file_atime ← fileatime -- file_ctime ← filectime -- file_group ← filegroup -- file_inode ← fileinode -- file_mtime ← filemtime -- file_owner ← fileowner -- file_perms ← fileperms -- file_size ← filesize -- file_type ← filetype -- **file_name_match** ← fnmatch (IEEE) -- **file_temp_name** ← tempnam (IEEE) -- file_copy ← copy (IEEE) -- file_stat ← stat (IEEE) -- **file_stat_clear_cache** ← clearstatcache -- **file_move_uploaded** ← move_upload_file -- **file_delete** ← unlink (There is dummy "delete()" function entry for unlink(). Unlink is a directory operation in fact, but made it as file_delete(). There will be dir_delete()) -- **file_rename** ← rename + + +New | Old | Comment +--- | --- | --- +link_info | linkinfo | +**link_stat** | lstat | IEEE +**link_chown** | lchown | IEEE +**link_chgrp** | lchgrp | IEEE +**link_read** | readlink | IEEE +**link_symbolic** | symlink | IEEE +**path_base_name** | basename | +path_info | pathinfo | +file_read | readfile | This could be file_read() or file_passthru(). If rename fopen()/etc with "file_" prefix, file_read() may conflict with fread() file_passthru() may conflict with fpassthru(). +**pipe_close** | pclose | IEEE +**pipe_open** | popen | IEEE +file_atime | fileatime | +file_ctime | filectime | +file_group | filegroup | +file_inode | fileinode | +file_mtime | filemtime | +file_owner | fileowner | +file_perms | fileperms | +file_size | filesize | +file_type | filetype | +**file_name_match** | fnmatch | IEEE +**file_temp_name** | tempnam | IEEE +file_copy | copy | IEEE +file_stat | stat | IEEE +**file_stat_clear_cache** | clearstatcache | +**file_move_uploaded** | move_upload_file | +**file_delete** | unlink | There is dummy "delete()" function entry for unlink(). Unlink is a directory operation in fact, but made it as file_delete(). There will be dir_delete() +**file_rename** | rename | f*() : Examples are fopen(), fread(). These functions are for file(stream) resource. "f" prefix functions are kept, there should be "ftemp(tmpfile)","frewind(rewind)" because these operates with file(stream) resource. -- fget_csv ← fgetcsv (IEEE) -- fput_csv ← fputcsv -- **frewind** ← rewind (This one is exception that does not have "f" prefix, but operates with file handle) -- **ftemp** ← tmpfile (This one is exception that does not have "f" prefix, but returns file handle) (IEEE) + +New | Old | Comment +--- | --- | --- +fget_csv | fgetcsv | IEEE +fput_csv | fputcsv | +**frewind** | rewind | This one is exception that does not have "f" prefix, but operates with file handle +**ftemp** | tmpfile | This one is exception that does not have "f" prefix, but returns file handle, IEEE + ### Other Standard Functions - -- time_sleep ← sleep (IEEE) -- time_nano_sleep ← time_nanosleep, **nanosleep** (IEEE) -- **time_micro_sleep** ← usleep (IEEE) -- time_unique_id ← uniqid (uniqid() is microtime() based) -- sys_get_load_avg ← sys_getloadavg -- php_strip_white_space ← php_strip_whitespace - - -- url_decode ← urldecode -- url_encode ← urlencode -- url_raw_decode ← rawurldecode -- url_raw_encode ← rawurlencode -- **url_parse** ← parse_url -- **url_build_query** ← http_build_query (Make it URL function) -- **url_meta_tags** ← get_meta_tags (Get meta tags from URL/file) -- **url_headers** ← get_headers (Get headers from URL) - - -- php_credits ← phpcredits -- php_info ← phpinfo -- php_version ← phpversion -- get_opt ← getopt -- get_env ← getenv (**This could be "env_get"**) (IEEE) -- put_env ← putenv (**This could be "env_set"**) (IEEE) -- Following get_() may be prefixed by "php_" rather than "get_". -- get_last_mod ← getlastmod (Return **main** script timestamp.) -- get_my_gid ← getmygid ("my_" prefix used because they return info about **current** script.) -- get_my_inode ← getmyinode -- get_my_pid ← getmypid -- get_my_uid ← getmyuid -- get_rusage ← getrusage - - -- bool_val ← boolval -- double_val ← doubleval -- float_val ← floatval -- int_val ← intval -- str_val ← strval -- **type_get** ← gettype -- **type_set** ← settype -- **type_resource** ← get_resource_type (Get resource type) - - -- php_defined_vars ← get_defined_vars - - - Most of Class/interface/trait related functions are prefixed by "class_"/"interface_"/"trait_". -- **class_called** ← get_called_class (Get late static binding class name. There are class_exists()/class_alias()) -- class_methods ← get_class_methods -- class_vars ← get_class_vars (Get class property) -- **class_get** ← get_class (Get class name of an object) -- **class_parent** ← get_parent_class -- class_object_vars ← get_object_vars (Get instance property) -- **class_declared** ← get_declared_classes -- **interface_declared** ← get_declared_interfaces (There is interface_exists()) -- **trait_declared** ← get_declared_traits (There is trait_exists()) - - - PHP related function are prefixed by "php_". -- php_extension_loaded ← extension_loaded -- **php_extension_loaded_all** ← get_loaded_extensions (Like ini_get_all()) -- **php_extension_functions** ← get_extension_funcs -- php_dl ← dl -- php_cfg_var ← get_cfg_var (Get value from configuration(INI) file including non-INI value) -- php_current_user ← get_current_user (Owner of current PHP script file) -- php_defined_constants ← get_defined_constants (There is [get_defined_vars()](http://php.net/manual/en/book.var.php "http://php.net/manual/en/book.var.php")) -- **php_include_path_get** ← get_include_path (Like ini_get/set/restore(). ini_set/get/restore() can do the same. Deprecate all them? or only have php_include_path() does both get/set?) -- **php_include_path_set** ← set_include_path -- **php_include_path_restore** ← restore_include_path -- php_included_files ← get_included_files -- php_required_files ← get_required_files -- **php_time_limit** ← set_time_limit ("_set" may be omitted. It changes "max_execution_time" INI. ini_set() can do the same. Deprecate?) + + + +New | Old | Comment +--- | --- | --- +time_sleep | sleep | IEEE +time_nano_sleep | time_nanosleep, **nanosleep**  | IEEE +**time_micro_sleep** | usleep | IEEE +time_unique_id | uniqid | uniqid() is microtime() based +sys_get_load_avg | sys_getloadavg | +php_strip_white_space | php_strip_whitespace | + + + +New | Old | Comment +--- | --- | --- +url_decode | urldecode | +url_encode | urlencode | +url_raw_decode | rawurldecode | +url_raw_encode | rawurlencode | +**url_parse** | parse_url | +**url_build_query** | http_build_query | Make it URL function +**url_meta_tags** | get_meta_tags | Get meta tags from URL/file +**url_headers** | get_headers | Get meta tags from URL/file + + + +New | Old | Comment +--- | --- | --- +php_credits | phpcredits | +php_info | phpinfo | +php_version | phpversion | +get_opt | getopt | +get_env | getenv | **This could be "env_get"**, IEEE +put_env | putenv | **This could be "env_set"**, IEEE + +Following get_() may be prefixed by "php_" rather than "get_". + +New | Old | Comment +--- | --- | --- +get_last_mod | getlastmod | Return **main** script timestamp. +get_my_gid | getmygid | "my_" prefix used because they return info about **current** script. +get_my_inode | getmyinode | +get_my_pid | getmypid | +get_my_uid | getmyuid | +get_rusage | getrusage | + + + +New | Old | Comment +--- | --- | --- +bool_val | boolval | +double_val | doubleval | +float_val | floatval | +int_val | intval | +str_val | strval | +**type_get** | gettype | +**type_set** | settype | +**type_resource** | get_resource_type | Get resource type + + + +New | Old | Comment +--- | --- | --- +php_defined_vars | get_defined_vars | + +  + +Most of Class/interface/trait related functions are prefixed by "class_"/"interface_"/"trait_". + +New | Old | Comment +--- | --- | --- +**class_called** | get_called_class | Get late static binding class name. There are class_exists()/class_alias() +class_methods | get_class_methods | +class_vars | get_class_vars | Get class property +**class_get** | get_class | Get class name of an object +**class_parent** | get_parent_class | +class_object_vars | get_object_vars | Get instance property +**class_declared** | get_declared_classes | +**interface_declared** | get_declared_interfaces | There is interface_exists() +**trait_declared** | get_declared_traits | There is trait_exists() + + + +PHP related function are prefixed by "php_". + +New | Old | Comment +--- | --- | --- +php_extension_loaded | extension_loaded | +**php_extension_loaded_all** | get_loaded_extensions | Like ini_get_all() +**php_extension_functions** | get_extension_funcs | +php_dl | dl | +php_cfg_var | get_cfg_var | Get value from configuration(INI) file including non-INI value +php_current_user | get_current_user | Owner of current PHP script file +php_defined_constants | get_defined_constants | There is [get_defined_vars()](https://php.net/manual/en/book.var.php "https://php.net/manual/en/book.var.php") +**php_include_path_get** | get_include_path | Like ini_get/set/restore(). ini_set/get/restore() can do the same. Deprecate all them? or only have php_include_path() does both get/set? +**php_include_path_set** | set_include_path | +**php_include_path_restore** | restore_include_path | +php_included_files | get_included_files | +php_required_files | get_required_files | +**php_time_limit** | set_time_limit | "_set" may be omitted. It changes "max_execution_time" INI. ini_set() can do the same. Deprecate? diff --git a/aliases.txt b/aliases.txt index 5f6c9ab..e9e7888 100644 --- a/aliases.txt +++ b/aliases.txt @@ -162,17 +162,17 @@ gd_jpeg2wbmp jpeg2wbmp gd_png2wbmp png2wbmp exif_image_type exif_imagetype exif_tag_name exif_tagname -ctype_alnum ctype_isalnum -ctype_alpha ctype_isalpha -ctype_cntrl ctype_iscntrl -ctype_digit ctype_isdigit -ctype_graph ctype_isgraph -ctype_lower ctype_islower -ctype_print ctype_isprint -ctype_punct ctype_ispunct -ctype_space ctype_isspace -ctype_upper ctype_isupper -ctype_xdigit ctype_isxdigit +ctype_is_alnum ctype_alnum +ctype_is_alpha ctype_alpha +ctype_is_cntrl ctype_cntrl +ctype_is_digit ctype_digit +ctype_is_graph ctype_graph +ctype_is_lower ctype_lower +ctype_is_print ctype_print +ctype_is_punct ctype_punct +ctype_is_space ctype_space +ctype_is_upper ctype_upper +ctype_is_xdigit ctype_xdigit mb_decode_mime_header mb_decode_mimeheader mb_decode_numeric_entity mb_decode_numericentity mb_encode_mime_header mb_encode_mimeheader @@ -189,6 +189,7 @@ sapi_request_headers getallheaders apache_virtual virtual apache_get_env apache_getenv apache_set_env apache_setenv +date_format date date_get getdate date_check checkdate time_part idate @@ -206,18 +207,18 @@ time_from_string strtotime dir_rename rename dir_delete rmdir dir_create mkdir -dir_chown← (IEEE) +dir_chown chown (IEEE) dir_chmod chmod -dir_chgrp chgrp(IEEE) +dir_chgrp chgrp (IEEE) dir_name dirname dir_glob glob -dir_set chdir(IEEE) +dir_set chdir (IEEE) dir_chroot chroot -dir_get getcwd(IEEE) +dir_get getcwd (IEEE) dir_open opendir dir_close closedir -dir_read readdir(IEEE) -dir_rewind rewinddir(IEEE) +dir_read readdir (IEEE) +dir_rewind rewinddir (IEEE) dir_scan scandir function_declared get_defined_functions function_create create_function @@ -336,8 +337,8 @@ array_sort_natural_case natcasesort array_in in_array array_range range array_shuffle shuffle -array_find mixed -array_key_find bool +array_find array_search +array_key_find array_key_exists link link link_info linkinfo link_stat lstat @@ -367,7 +368,7 @@ file_temp_name tempnam file_copy copy file_stat stat file_stat_clear_cache clearstatcache -file_move_uploaded move_upload_file +file_move_uploaded move_uploaded_file file_delete unlink file_rename rename fopen fopen @@ -449,3 +450,4 @@ php_include_path_restore restore_include_path php_included_files get_included_files php_required_files get_required_files php_time_limit set_time_limit +is_set isset diff --git a/bin/generate.php b/bin/generate.php index e4685be..96600ce 100644 --- a/bin/generate.php +++ b/bin/generate.php @@ -17,7 +17,7 @@ $stubs = []; $argLists = []; -$regexp = '~\/\*\*(?:\n\s\*.*)+\nfunction (\w+) \((.*?)\)(?= {})~m'; +$regexp = '~\/\*\*(?:\n\s\*.*)+\n+function\s+(\w+)\s*\((.*?)\):*\w*(?=\s*{\s*})~m'; foreach ($stubFiles as $file) { $contents = file_get_contents($file); diff --git a/src/functions.php b/src/functions.php index 8375ec4..9dec11b 100644 --- a/src/functions.php +++ b/src/functions.php @@ -17,26 +17,32 @@ /** * Add two arbitrary precision numbers - * @link http://php.net/manual/en/function.bcadd.php + * @link https://php.net/manual/en/function.bcadd.php * @param string $left_operand

* The left operand, as a string. *

* @param string $right_operand

* The right operand, as a string. *

- * @param int $scale [optional] + * @param int $scale [optional]

+ * This optional parameter is used to set the number of digits after the + * decimal place in the result. If omitted, it will default to the scale + * set globally with the {@link bcscale()} function, or fallback to 0 if + * this has not been set. + *

* @return string The sum of the two operands, as a string. * @since 4.0 * @since 5.0 + * @since 7.0 */ -function bc_add ($left_operand, $right_operand, $scale = null) +function bc_add ($left_operand, $right_operand, $scale = 0) { return bcadd($left_operand, $right_operand, $scale); } /** * Compare two arbitrary precision numbers - * @link http://php.net/manual/en/function.bccomp.php + * @link https://php.net/manual/en/function.bccomp.php * @param string $left_operand

* The left operand, as a string. *

@@ -53,120 +59,157 @@ function bc_add ($left_operand, $right_operand, $scale = null) * right_operand, -1 otherwise. * @since 4.0 * @since 5.0 + * @since 7.0 */ -function bc_comp ($left_operand, $right_operand, $scale = null) +function bc_comp ($left_operand, $right_operand, $scale = 0) { return bccomp($left_operand, $right_operand, $scale); } /** * Divide two arbitrary precision numbers - * @link http://php.net/manual/en/function.bcdiv.php - * @param string $left_operand

- * The left operand, as a string. + * @link https://php.net/manual/en/function.bcdiv.php + * @param string $dividend

+ * The dividend, as a string. *

- * @param string $right_operand

- * The right operand, as a string. + * @param string $divisor

+ * The divisor, as a string. *

- * @param int $scale [optional] - * @return string the result of the division as a string, or NULL if - * right_operand is 0. + * @param int $scale [optional]

+ * This optional parameter is used to set the number of digits after the + * decimal place in the result. If omitted, it will default to the scale + * set globally with the {@link bcscale()} function, or fallback to 0 if + * this has not been set. + *

+ * @return string|null the result of the division as a string, or NULL if + * divisor is 0. * @since 4.0 * @since 5.0 + * @since 7.0 */ -function bc_div ($left_operand, $right_operand, $scale = null) +function bc_div ($dividend, $divisor, $scale = 0) { - return bcdiv($left_operand, $right_operand, $scale); + return bcdiv($dividend, $divisor, $scale); } /** * Get modulus of an arbitrary precision number - * @link http://php.net/manual/en/function.bcmod.php - * @param string $left_operand

- * The left operand, as a string. + * @link https://php.net/manual/en/function.bcmod.php + * @param string $dividend

+ * The dividend, as a string. *

- * @param string $modulus

- * The modulus, as a string. + * @param string $divisor

+ * The divisor, as a string. *

- * @return string the modulus as a string, or NULL if - * modulus is 0. + * @param int $scale [optional]

+ * This optional parameter is used to set the number of digits after the + * decimal place in the result. If omitted, it will default to the scale + * set globally with the {@link bcscale()} function, or fallback to 0 if + * this has not been set. + *

+ * @return string|null the modulus as a string, or NULL if + * divisor is 0. * @since 4.0 * @since 5.0 + * @since 7.0 + * @since 7.2.0 scale param added, dividend/divisor no longer truncated */ -function bc_mod ($left_operand, $modulus) +function bc_mod ($dividend, $divisor, $scale = 0) { - return bcmod($left_operand, $modulus); + return bcmod($dividend, $divisor, $scale); } /** * Multiply two arbitrary precision numbers - * @link http://php.net/manual/en/function.bcmul.php + * @link https://php.net/manual/en/function.bcmul.php * @param string $left_operand

* The left operand, as a string. *

* @param string $right_operand

* The right operand, as a string. *

- * @param int $scale [optional] + * @param int $scale [optional]

+ * This optional parameter is used to set the number of digits after the + * decimal place in the result. If omitted, it will default to the scale + * set globally with the {@link bcscale()} function, or fallback to 0 if + * this has not been set. + *

* @return string the result as a string. * @since 4.0 * @since 5.0 + * @since 7.0 */ -function bc_mul ($left_operand, $right_operand, $scale = null) +function bc_mul ($left_operand, $right_operand, $scale = 0) { return bcmul($left_operand, $right_operand, $scale); } /** * Raise an arbitrary precision number to another - * @link http://php.net/manual/en/function.bcpow.php - * @param string $left_operand

- * The left operand, as a string. + * @link https://php.net/manual/en/function.bcpow.php + * @param string $base

+ * The base, as a string. *

- * @param string $right_operand

- * The right operand, as a string. + * @param string $exponent

+ * The exponent, as a string. If the exponent is non-integral, it is truncated. + * The valid range of the exponent is platform specific, but is at least + * -2147483648 to 2147483647. + *

+ * @param int $scale [optional]

+ * This optional parameter is used to set the number of digits after the + * decimal place in the result. If omitted, it will default to the scale + * set globally with the {@link bcscale()} function, or fallback to 0 if + * this has not been set. *

- * @param int $scale [optional] * @return string the result as a string. * @since 4.0 * @since 5.0 + * @since 7.0 */ -function bc_pow ($left_operand, $right_operand, $scale = null) +function bc_pow ($base, $exponent, $scale = 0) { - return bcpow($left_operand, $right_operand, $scale); + return bcpow($base, $exponent, $scale); } /** * Raise an arbitrary precision number to another, reduced by a specified modulus - * @link http://php.net/manual/en/function.bcpowmod.php - * @param string $left_operand

- * The left operand, as a string. + * @link https://php.net/manual/en/function.bcpowmod.php + * @param string $base

+ * The base, as an integral string (i.e. the scale has to be zero). *

- * @param string $right_operand

- * The right operand, as a string. + * @param string $exponent

+ * The exponent, as an non-negative, integral string (i.e. the scale has to be + * zero). *

* @param string $modulus

- * The modulus, as a string. + * The modulus, as an integral string (i.e. the scale has to be zero). *

- * @param int $scale [optional] - * @return string the result as a string, or NULL if modulus - * is 0. + * @param int $scale [optional]

+ * This optional parameter is used to set the number of digits after the + * decimal place in the result. If omitted, it will default to the scale + * set globally with the {@link bcscale()} function, or fallback to 0 if + * this has not been set. + *

+ * @return string|null the result as a string, or NULL if modulus + * is 0 or exponent is negative. * @since 5.0 + * @since 7.0 */ -function bc_pow_mod ($left_operand, $right_operand, $modulus, $scale = null) +function bc_pow_mod ($base, $exponent, $modulus, $scale = 0) { - return bcpowmod($left_operand, $right_operand, $modulus, $scale); + return bcpowmod($base, $exponent, $modulus, $scale); } /** * Set default scale parameter for all bc math functions - * @link http://php.net/manual/en/function.bcscale.php + * @link https://php.net/manual/en/function.bcscale.php * @param int $scale

* The scale factor. *

* @return bool TRUE on success or FALSE on failure. * @since 4.0 * @since 5.0 + * @since 7.0 */ function bc_scale ($scale) { @@ -175,7 +218,7 @@ function bc_scale ($scale) /** * Get the square root of an arbitrary precision number - * @link http://php.net/manual/en/function.bcsqrt.php + * @link https://php.net/manual/en/function.bcsqrt.php * @param string $operand

* The operand, as a string. *

@@ -184,6 +227,7 @@ function bc_scale ($scale) * operand is negative. * @since 4.0 * @since 5.0 + * @since 7.0 */ function bc_sqrt ($operand, $scale = null) { @@ -192,26 +236,32 @@ function bc_sqrt ($operand, $scale = null) /** * Subtract one arbitrary precision number from another - * @link http://php.net/manual/en/function.bcsub.php + * @link https://php.net/manual/en/function.bcsub.php * @param string $left_operand

* The left operand, as a string. *

* @param string $right_operand

* The right operand, as a string. *

- * @param int $scale [optional] + * @param int $scale [optional]

+ * This optional parameter is used to set the number of digits after the + * decimal place in the result. If omitted, it will default to the scale + * set globally with the {@link bcscale()} function, or fallback to 0 if + * this has not been set. + *

* @return string The result of the subtraction, as a string. * @since 4.0 * @since 5.0 + * @since 7.0 */ -function bc_sub ($left_operand, $right_operand, $scale = null) +function bc_sub ($left_operand, $right_operand, $scale = 0) { return bcsub($left_operand, $right_operand, $scale); } /** * Specify the character encoding in which the messages from the DOMAIN message catalog will be returned - * @link http://php.net/manual/en/function.bind-textdomain-codeset.php + * @link https://php.net/manual/en/function.bind-textdomain-codeset.php * @param string $domain

* The domain *

@@ -229,7 +279,7 @@ function gettext_bind_text_domain_codeset ($domain, $codeset) /** * Sets the path for a domain - * @link http://php.net/manual/en/function.bindtextdomain.php + * @link https://php.net/manual/en/function.bindtextdomain.php * @param string $domain

* The domain *

@@ -247,7 +297,7 @@ function gettext_bind_text_domain ($domain, $directory) /** * Overrides the domain for a single lookup - * @link http://php.net/manual/en/function.dcgettext.php + * @link https://php.net/manual/en/function.dcgettext.php * @param string $domain

* The domain *

@@ -268,7 +318,7 @@ function gettext_dc ($domain, $message, $category) /** * Plural version of dcgettext - * @link http://php.net/manual/en/function.dcngettext.php + * @link https://php.net/manual/en/function.dcngettext.php * @param string $domain

* The domain *

@@ -287,7 +337,7 @@ function gettext_dcn ($domain, $msgid1, $msgid2, $n, $category) /** * Override the current domain - * @link http://php.net/manual/en/function.dgettext.php + * @link https://php.net/manual/en/function.dgettext.php * @param string $domain

* The domain *

@@ -305,7 +355,7 @@ function gettext_d ($domain, $message) /** * Plural version of dgettext - * @link http://php.net/manual/en/function.dngettext.php + * @link https://php.net/manual/en/function.dngettext.php * @param string $domain

* The domain *

@@ -323,7 +373,7 @@ function gettext_dn ($domain, $msgid1, $msgid2, $n) /** * Plural version of gettext - * @link http://php.net/manual/en/function.ngettext.php + * @link https://php.net/manual/en/function.ngettext.php * @param string $msgid1 * @param string $msgid2 * @param int $n @@ -340,7 +390,7 @@ function gettext_n ($msgid1, $msgid2, $n) /** * Sets the default domain - * @link http://php.net/manual/en/function.textdomain.php + * @link https://php.net/manual/en/function.textdomain.php * @param string $text_domain

* The new message domain, or NULL to get the current setting without * changing it @@ -357,12 +407,12 @@ function gettext_text_domain ($text_domain) /** * Close a bzip2 file - * @link http://php.net/manual/en/function.bzclose.php + * @link https://php.net/manual/en/function.bzclose.php * @param resource $bz

* The file pointer. It must be valid and must point to a file * successfully opened by bzopen. *

- * @return int TRUE on success or FALSE on failure. + * @return bool TRUE on success or FALSE on failure. * @since 4.0.4 * @since 5.0 */ @@ -373,7 +423,7 @@ function bz_close ($bz) /** * Compress a string into bzip2 encoded data - * @link http://php.net/manual/en/function.bzcompress.php + * @link https://php.net/manual/en/function.bzcompress.php * @param string $source

* The string to compress. *

@@ -402,7 +452,7 @@ function bz_compress ($source, $blocksize = 4, $workfactor = 0) /** * Decompresses bzip2 encoded data - * @link http://php.net/manual/en/function.bzdecompress.php + * @link https://php.net/manual/en/function.bzdecompress.php * @param string $source

* The string to decompress. *

@@ -426,7 +476,7 @@ function bz_decompress ($source, $small = 0) /** * Returns a bzip2 error number - * @link http://php.net/manual/en/function.bzerrno.php + * @link https://php.net/manual/en/function.bzerrno.php * @param resource $bz

* The file pointer. It must be valid and must point to a file * successfully opened by bzopen. @@ -442,7 +492,7 @@ function bz_errno ($bz) /** * Returns the bzip2 error number and error string in an array - * @link http://php.net/manual/en/function.bzerror.php + * @link https://php.net/manual/en/function.bzerror.php * @param resource $bz

* The file pointer. It must be valid and must point to a file * successfully opened by bzopen. @@ -460,7 +510,7 @@ function bz_error ($bz) /** * Returns a bzip2 error string - * @link http://php.net/manual/en/function.bzerrstr.php + * @link https://php.net/manual/en/function.bzerrstr.php * @param resource $bz

* The file pointer. It must be valid and must point to a file * successfully opened by bzopen. @@ -476,12 +526,12 @@ function bz_errstr ($bz) /** * Force a write of all buffered data - * @link http://php.net/manual/en/function.bzflush.php + * @link https://php.net/manual/en/function.bzflush.php * @param resource $bz

* The file pointer. It must be valid and must point to a file * successfully opened by bzopen. *

- * @return int TRUE on success or FALSE on failure. + * @return bool TRUE on success or FALSE on failure. * @since 4.0.4 * @since 5.0 */ @@ -492,7 +542,7 @@ function bz_flush ($bz) /** * Opens a bzip2 compressed file - * @link http://php.net/manual/en/function.bzopen.php + * @link https://php.net/manual/en/function.bzopen.php * @param string $filename

* The name of the file to open, or an existing stream resource. *

@@ -513,7 +563,7 @@ function bz_open ($filename, $mode) /** * Binary safe bzip2 file read - * @link http://php.net/manual/en/function.bzread.php + * @link https://php.net/manual/en/function.bzread.php * @param resource $bz

* The file pointer. It must be valid and must point to a file * successfully opened by bzopen. @@ -534,7 +584,7 @@ function bz_read ($bz, $length = 1024) /** * Binary safe bzip2 file write - * @link http://php.net/manual/en/function.bzwrite.php + * @link https://php.net/manual/en/function.bzwrite.php * @param resource $bz

* The file pointer. It must be valid and must point to a file * successfully opened by bzopen. @@ -558,7 +608,7 @@ function bz_write ($bz, $data, $length = null) /** * Close an open gz-file pointer - * @link http://php.net/manual/en/function.gzclose.php + * @link https://php.net/manual/en/function.gzclose.php * @param resource $zp

* The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. @@ -574,7 +624,7 @@ function gz_close ($zp) /** * Compress a string - * @link http://php.net/manual/en/function.gzcompress.php + * @link https://php.net/manual/en/function.gzcompress.php * @param string $data

* The data to compress. *

@@ -588,7 +638,7 @@ function gz_close ($zp) * @param int $encoding [optional]

* One of ZLIB_ENCODING_* constants. *

- * @return string The compressed string or FALSE if an error occurred. + * @return string|false The compressed string or FALSE if an error occurred. * @since 4.0.1 * @since 5.0 */ @@ -599,14 +649,14 @@ function gz_compress ($data, $level = -1, $encoding = ZLIB_ENCODING_DEFLATE) /** * Decodes a gzip compressed string - * @link http://php.net/manual/en/function.gzdecode.php + * @link https://php.net/manual/en/function.gzdecode.php * @param string $data

* The data to decode, encoded by gzencode. *

* @param int $length [optional]

* The maximum length of data to decode. *

- * @return string The decoded string, or FALSE if an error occurred. + * @return string|false The decoded string, or FALSE if an error occurred. * @since 5.4.0 */ function gz_decode ($data, $length = null) @@ -616,7 +666,7 @@ function gz_decode ($data, $length = null) /** * Deflate a string - * @link http://php.net/manual/en/function.gzdeflate.php + * @link https://php.net/manual/en/function.gzdeflate.php * @param string $data

* The data to deflate. *

@@ -628,7 +678,7 @@ function gz_decode ($data, $length = null) * @param int $encoding [optional]

* One of ZLIB_ENCODING_* constants. *

- * @return string The deflated string or FALSE if an error occurred. + * @return string|false The deflated string or FALSE if an error occurred. * @since 4.0.4 * @since 5.0 */ @@ -639,7 +689,7 @@ function gz_deflate ($data, $level = -1, $encoding = ZLIB_ENCODING_RAW) /** * Create a gzip compressed string - * @link http://php.net/manual/en/function.gzencode.php + * @link https://php.net/manual/en/function.gzencode.php * @param string $data

* The data to encode. *

@@ -662,7 +712,7 @@ function gz_deflate ($data, $level = -1, $encoding = ZLIB_ENCODING_RAW) * RFC 1950 compliant output, consisting of a zlib header, the deflated * data, and an Adler checksum. *

- * @return string The encoded string, or FALSE if an error occurred. + * @return string|false The encoded string, or FALSE if an error occurred. * @since 4.0.4 * @since 5.0 */ @@ -673,12 +723,12 @@ function gz_encode ($data, $level = -1, $encoding_mode = FORCE_GZIP) /** * Test for EOF on a gz-file pointer - * @link http://php.net/manual/en/function.gzeof.php + * @link https://php.net/manual/en/function.gzeof.php * @param resource $zp

* The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. *

- * @return int TRUE if the gz-file pointer is at EOF or an error occurs; + * @return int|bool TRUE if the gz-file pointer is at EOF or an error occurs; * otherwise returns FALSE. * @since 4.0 * @since 5.0 @@ -690,7 +740,7 @@ function gz_eof ($zp) /** * Read entire gz-file into an array - * @link http://php.net/manual/en/function.gzfile.php + * @link https://php.net/manual/en/function.gzfile.php * @param string $filename

* The file name. *

@@ -709,12 +759,12 @@ function gz_file ($filename, $use_include_path = 0) /** * Get character from gz-file pointer - * @link http://php.net/manual/en/function.gzgetc.php + * @link https://php.net/manual/en/function.gzgetc.php * @param resource $zp

* The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. *

- * @return string The uncompressed character or FALSE on EOF (unlike gzeof). + * @return string|false The uncompressed character or FALSE on EOF (unlike gzeof). * @since 4.0 * @since 5.0 */ @@ -725,7 +775,7 @@ function gz_getc ($zp) /** * Get line from file pointer - * @link http://php.net/manual/en/function.gzgets.php + * @link https://php.net/manual/en/function.gzgets.php * @param resource $zp

* The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. @@ -733,7 +783,7 @@ function gz_getc ($zp) * @param int $length [optional]

* The length of data to get. *

- * @return string The uncompressed string, or FALSE on error. + * @return string|false The uncompressed string, or FALSE on error. * @since 4.0 * @since 5.0 */ @@ -744,7 +794,7 @@ function gz_gets ($zp, $length) /** * Get line from gz-file pointer and strip HTML tags - * @link http://php.net/manual/en/function.gzgetss.php + * @link https://php.net/manual/en/function.gzgetss.php * @param resource $zp

* The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. @@ -756,9 +806,10 @@ function gz_gets ($zp, $length) * You can use this optional parameter to specify tags which should not * be stripped. *

- * @return string The uncompressed and striped string, or FALSE on error. + * @return string|false The uncompressed and striped string, or FALSE on error. * @since 4.0 * @since 5.0 + * @deprecated 7.3 */ function gz_getss ($zp, $length, $allowable_tags = null) { @@ -767,14 +818,14 @@ function gz_getss ($zp, $length, $allowable_tags = null) /** * Inflate a deflated string - * @link http://php.net/manual/en/function.gzinflate.php + * @link https://php.net/manual/en/function.gzinflate.php * @param string $data

* The data compressed by gzdeflate. *

* @param int $length [optional]

* The maximum length of data to decode. *

- * @return string The original uncompressed data or FALSE on error. + * @return string|false The original uncompressed data or FALSE on error. *

*

* The function will return an error if the uncompressed data is more than @@ -790,7 +841,7 @@ function gz_inflate ($data, $length = 0) /** * Open gz-file - * @link http://php.net/manual/en/function.gzopen.php + * @link https://php.net/manual/en/function.gzopen.php * @param string $filename

* The file name. *

@@ -808,7 +859,7 @@ function gz_inflate ($data, $length = 0) * You can set this optional parameter to 1, if you * want to search for the file in the include_path too. *

- * @return resource a file pointer to the file opened, after that, everything you read + * @return resource|false a file pointer to the file opened, after that, everything you read * from this file descriptor will be transparently decompressed and what you * write gets compressed. *

@@ -824,7 +875,7 @@ function gz_open ($filename, $mode, $use_include_path = 0) /** * Output all remaining data on a gz-file pointer - * @link http://php.net/manual/en/function.gzpassthru.php + * @link https://php.net/manual/en/function.gzpassthru.php * @param resource $zp

* The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. @@ -841,7 +892,7 @@ function gz_passthru ($zp) /** * Alias of gzwrite - * @link http://php.net/manual/en/function.gzputs.php + * @link https://php.net/manual/en/function.gzputs.php * @param $fp * @param $str * @param $length [optional] @@ -855,7 +906,7 @@ function gz_puts ($fp, $str, $length) /** * Binary-safe gz-file read - * @link http://php.net/manual/en/function.gzread.php + * @link https://php.net/manual/en/function.gzread.php * @param resource $zp

* The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. @@ -874,7 +925,7 @@ function gz_read ($zp, $length) /** * Rewind the position of a gz-file pointer - * @link http://php.net/manual/en/function.gzrewind.php + * @link https://php.net/manual/en/function.gzrewind.php * @param resource $zp

* The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. @@ -890,7 +941,7 @@ function gz_rewind ($zp) /** * Seek on a gz-file pointer - * @link http://php.net/manual/en/function.gzseek.php + * @link https://php.net/manual/en/function.gzseek.php * @param resource $zp

* The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. @@ -919,12 +970,12 @@ function gz_seek ($zp, $offset, $whence = SEEK_SET) /** * Tell gz-file pointer read/write position - * @link http://php.net/manual/en/function.gztell.php + * @link https://php.net/manual/en/function.gztell.php * @param resource $zp

* The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. *

- * @return int The position of the file pointer or FALSE if an error occurs. + * @return int|false The position of the file pointer or FALSE if an error occurs. * @since 4.0 * @since 5.0 */ @@ -935,14 +986,14 @@ function gz_tell ($zp) /** * Uncompress a compressed string - * @link http://php.net/manual/en/function.gzuncompress.php + * @link https://php.net/manual/en/function.gzuncompress.php * @param string $data

* The data compressed by gzcompress. *

* @param int $length [optional]

* The maximum length of data to decode. *

- * @return string The original uncompressed data or FALSE on error. + * @return string|false The original uncompressed data or FALSE on error. *

*

* The function will return an error if the uncompressed data is more than @@ -958,7 +1009,7 @@ function gz_uncompress ($data, $length = 0) /** * Binary-safe gz-file write - * @link http://php.net/manual/en/function.gzwrite.php + * @link https://php.net/manual/en/function.gzwrite.php * @param resource $zp

* The gz-file pointer. It must be valid, and must point to a file * successfully opened by gzopen. @@ -990,7 +1041,7 @@ function gz_write ($zp, $string, $length = null) /** * Output a gz-file - * @link http://php.net/manual/en/function.readgzfile.php + * @link https://php.net/manual/en/function.readgzfile.php * @param string $filename

* The file name. This file will be opened from the filesystem and its * contents written to standard output. @@ -1013,7 +1064,7 @@ function gz_read_file ($filename, $use_include_path = 0) /** * Get the size of an image - * @link http://php.net/manual/en/function.getimagesize.php + * @link https://php.net/manual/en/function.getimagesize.php * @param string $filename

* This parameter specifies the file you wish to retrieve information * about. It can reference a local file or (configuration permitting) a @@ -1029,7 +1080,7 @@ function gz_read_file ($filename, $use_include_path = 0) * You can use the iptcparse function to parse the * binary APP13 marker into something readable. *

- * @return array|bool an array with 7 elements. + * @return array|false an array with 7 elements. *

*

* Index 0 and 1 contains respectively the width and the height of the image. @@ -1054,7 +1105,6 @@ function gz_read_file ($filename, $use_include_path = 0) * This information can be used to deliver images with correct the HTTP * Content-type header: * getimagesize and MIME types - * ]]> *

*

* channels will be 3 for RGB pictures and 4 for CMYK @@ -1083,7 +1133,7 @@ function gd_image_size ($filename, array &$imageinfo = null) /** * PHP > 5.4.0
* Get the size of an image from a string. - * @link http://www.php.net/manual/en/function.getimagesizefromstring.php + * @link https://secure.php.net/manual/en/function.getimagesizefromstring.php * @param string $imagedata The image data, as a string. * @param array $imageinfo This optional parameter allows you to extract
* some extended information from the image file. Currently, this will
@@ -1091,7 +1141,7 @@ function gd_image_size ($filename, array &$imageinfo = null) * Some programs use these APP markers to embed text information in images.
* A very common one is to embed » IPTC information in the APP13 marker.
* You can use the iptcparse() function to parse the binary APP13 marker into something readable. - * @return array|bool Returns an array with 7 elements.
+ * @return array|false Returns an array with 7 elements.
* Index 0 and 1 contains respectively the width and the height of the image.
* Index 2 is one of the IMAGETYPE_XXX constants indicating the type of the image.
* Index 3 is a text string with the correct height="yyy" width="xxx" string
@@ -1105,7 +1155,7 @@ function gd_image_size_from_string ($imagedata , array &$imageinfo = null) /** * Get file extension for image type - * @link http://php.net/manual/en/function.image-type-to-extension.php + * @link https://php.net/manual/en/function.image-type-to-extension.php * @param int $imagetype

* One of the IMAGETYPE_XXX constant. *

@@ -1120,9 +1170,101 @@ function gd_type_to_extension ($imagetype, $include_dot = null) return image_type_to_extension($imagetype, $include_dot); } +/** + * Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype + * @since 4.3.0 + * @since 5.0 + * @link https://php.net/manual/en/function.image-type-to-mime-type.php + * @param int $imagetype

+ * One of the IMAGETYPE_XXX constants. + *

+ * @return string The returned values are as follows + * + * Returned values Constants + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
imagetypeReturned value
IMAGETYPE_GIFimage/gif
IMAGETYPE_JPEGimage/jpeg
IMAGETYPE_PNGimage/png
IMAGETYPE_SWFapplication/x-shockwave-flash
IMAGETYPE_PSDimage/psd
IMAGETYPE_BMPimage/bmp
IMAGETYPE_TIFF_II (intel byte order)image/tiff
+ * IMAGETYPE_TIFF_MM (motorola byte order) + * image/tiff
IMAGETYPE_JPCapplication/octet-stream
IMAGETYPE_JP2image/jp2
IMAGETYPE_JPXapplication/octet-stream
IMAGETYPE_JB2application/octet-stream
IMAGETYPE_SWCapplication/x-shockwave-flash
IMAGETYPE_IFFimage/iff
IMAGETYPE_WBMPimage/vnd.wap.wbmp
IMAGETYPE_XBMimage/xbm
IMAGETYPE_ICOimage/vnd.microsoft.icon
+ */ +function gd_type_to_mime_type ($imagetype) +{ + return image_type_to_mime_type($imagetype); +} + /** * Output image to browser or file - * @link http://php.net/manual/en/function.image2wbmp.php + * @link https://php.net/manual/en/function.image2wbmp.php * @param resource $image * @param string $filename [optional]

* Path to the saved file. If not given, the raw image stream will be @@ -1134,15 +1276,57 @@ function gd_type_to_extension ($imagetype, $include_dot = null) * @return bool true on success or false on failure. * @since 4.0.5 * @since 5.0 + * @deprecated 7.3.0 Use imagewbmp() instead */ function gd_2wbmp ($image, $filename = null, $threshold = null) { return image2wbmp($image, $filename, $threshold); } +/** + * Return an image containing the affine tramsformed src image, using an optional clipping area + * @link https://secure.php.net/manual/en/function.imageaffine.php + * @param resource $image

An image resource, returned by one of the image creation functions, + * such as {@link https://secure.php.net/manual/en/function.imagecreatetruecolor.php imagecreatetruecolor()}.

+ * @param array $affine

Array with keys 0 to 5.

+ * @param array $clip [optional]

Array with keys "x", "y", "width" and "height".

+ * @return resource|bool Return affined image resource on success or FALSE on failure. + */ +function gd_affine($image, $affine, $clip = null) +{ + return imageaffine($image, $affine, $clip); +} + +/** + * Concat two matrices (as in doing many ops in one go) + * @link https://secure.php.net/manual/en/function.imageaffinematrixconcat.php + * @param array $m1

Array with keys 0 to 5.

+ * @param array $m2

Array with keys 0 to 5.

+ * @return array|bool Array with keys 0 to 5 and float values or FALSE on failure. + * @since 5.5.0 + */ +function gd_affine_matrix_concat(array $m1, array $m2) +{ + return imageaffinematrixconcat($m1, $m2); +} + +/** + * Return an image containing the affine tramsformed src image, using an optional clipping area + * @link https://secure.php.net/manual/en/function.imageaffinematrixget.php + * @param int $type

One of IMG_AFFINE_* constants. + * @param mixed $options [optional] + * @return array|bool Array with keys 0 to 5 and float values or FALSE on failure. + * @since 5.5.0 + */ + +function gd_affine_matrix_get ($type, $options = null) +{ + return imageaffinematrixget($type, $options); +} + /** * Set the blending mode for an image - * @link http://php.net/manual/en/function.imagealphablending.php + * @link https://php.net/manual/en/function.imagealphablending.php * @param resource $image * @param bool $blendmode

* Whether to enable the blending mode or not. On true color images @@ -1159,7 +1343,7 @@ function gd_alpha_blending ($image, $blendmode) /** * Should antialias functions be used or not - * @link http://php.net/manual/en/function.imageantialias.php + * @link https://php.net/manual/en/function.imageantialias.php * @param resource $image * @param bool $enabled

* Whether to enable antialiasing or not. @@ -1175,7 +1359,7 @@ function gd_antialias ($image, $enabled) /** * Draws an arc - * @link http://php.net/manual/en/function.imagearc.php + * @link https://php.net/manual/en/function.imagearc.php * @param resource $image * @param int $cx

* x-coordinate of the center. @@ -1212,7 +1396,7 @@ function gd_arc ($image, $cx, $cy, $width, $height, $start, $end, $color) /** * Draw a character horizontally - * @link http://php.net/manual/en/function.imagechar.php + * @link https://php.net/manual/en/function.imagechar.php * @param resource $image * @param int $font * @param int $x

@@ -1239,7 +1423,7 @@ function gd_char ($image, $font, $x, $y, $c, $color) /** * Draw a character vertically - * @link http://php.net/manual/en/function.imagecharup.php + * @link https://php.net/manual/en/function.imagecharup.php * @param resource $image * @param int $font * @param int $x

@@ -1266,12 +1450,12 @@ function gd_charup ($image, $font, $x, $y, $c, $color) /** * Allocate a color for an image - * @link http://php.net/manual/en/function.imagecolorallocate.php + * @link https://php.net/manual/en/function.imagecolorallocate.php * @param resource $image * @param int $red

Value of red component.

* @param int $green

Value of green component.

* @param int $blue

Value of blue component.

- * @return int A color identifier or FALSE if the allocation failed. + * @return int|false A color identifier or FALSE if the allocation failed. * @since 4.0 * @since 5.0 */ @@ -1282,7 +1466,7 @@ function gd_color_allocate ($image, $red, $green, $blue) /** * Allocate a color for an image - * @link http://php.net/manual/en/function.imagecolorallocatealpha.php + * @link https://php.net/manual/en/function.imagecolorallocatealpha.php * @param resource $image * @param int $red

* Value of red component. @@ -1298,7 +1482,7 @@ function gd_color_allocate ($image, $red, $green, $blue) * 0 indicates completely opaque while * 127 indicates completely transparent. *

- * @return int A color identifier or false if the allocation failed. + * @return int|false A color identifier or false if the allocation failed. * @since 4.3.2 * @since 5.0 */ @@ -1309,7 +1493,7 @@ function gd_color_allocate_alpha ($image, $red, $green, $blue, $alpha) /** * Get the index of the color of a pixel - * @link http://php.net/manual/en/function.imagecolorat.php + * @link https://php.net/manual/en/function.imagecolorat.php * @param resource $image * @param int $x

* x-coordinate of the point. @@ -1317,7 +1501,7 @@ function gd_color_allocate_alpha ($image, $red, $green, $blue, $alpha) * @param int $y

* y-coordinate of the point. *

- * @return int the index of the color. + * @return int|false the index of the color or FALSE on failure * @since 4.0 * @since 5.0 */ @@ -1328,13 +1512,13 @@ function gd_color_at ($image, $x, $y) /** * Get the index of the closest color to the specified color - * @link http://php.net/manual/en/function.imagecolorclosest.php + * @link https://php.net/manual/en/function.imagecolorclosest.php * @param resource $image * @param int $red

Value of red component.

* @param int $green

Value of green component.

* @param int $blue

Value of blue component.

- * @return int the index of the closest color, in the palette of the image, to - * the specified one + * @return int|false the index of the closest color, in the palette of the image, to + * the specified one or FALSE on failure * @since 4.0 * @since 5.0 */ @@ -1345,7 +1529,7 @@ function gd_color_closest ($image, $red, $green, $blue) /** * Get the index of the closest color to the specified color + alpha - * @link http://php.net/manual/en/function.imagecolorclosestalpha.php + * @link https://php.net/manual/en/function.imagecolorclosestalpha.php * @param resource $image * @param int $red

* Value of red component. @@ -1361,7 +1545,8 @@ function gd_color_closest ($image, $red, $green, $blue) * 0 indicates completely opaque while * 127 indicates completely transparent. *

- * @return int the index of the closest color in the palette. + * @return int|false the index of the closest color in the palette or + * FALSE on failure * @since 4.0.6 * @since 5.0 */ @@ -1372,13 +1557,13 @@ function gd_color_closest_alpha ($image, $red, $green, $blue, $alpha) /** * Get the index of the color which has the hue, white and blackness - * @link http://php.net/manual/en/function.imagecolorclosesthwb.php + * @link https://php.net/manual/en/function.imagecolorclosesthwb.php * @param resource $image * @param int $red

Value of red component.

* @param int $green

Value of green component.

* @param int $blue

Value of blue component.

- * @return int an integer with the index of the color which has - * the hue, white and blackness nearest the given color. + * @return int|false an integer with the index of the color which has + * the hue, white and blackness nearest the given color or FALSE on failure * @since 4.0.1 * @since 5.0 */ @@ -1389,7 +1574,7 @@ function gd_color_closest_hwb ($image, $red, $green, $blue) /** * De-allocate a color for an image - * @link http://php.net/manual/en/function.imagecolordeallocate.php + * @link https://php.net/manual/en/function.imagecolordeallocate.php * @param resource $image * @param int $color

* The color identifier. @@ -1405,13 +1590,13 @@ function gd_color_deallocate ($image, $color) /** * Get the index of the specified color - * @link http://php.net/manual/en/function.imagecolorexact.php + * @link https://php.net/manual/en/function.imagecolorexact.php * @param resource $image * @param int $red

Value of red component.

* @param int $green

Value of green component.

* @param int $blue

Value of blue component.

- * @return int the index of the specified color in the palette, or -1 if the - * color does not exist. + * @return int|false the index of the specified color in the palette, -1 if the + * color does not exist, or FALSE on failure * @since 4.0 * @since 5.0 */ @@ -1422,7 +1607,7 @@ function gd_color_exact ($image, $red, $green, $blue) /** * Get the index of the specified color + alpha - * @link http://php.net/manual/en/function.imagecolorexactalpha.php + * @link https://php.net/manual/en/function.imagecolorexactalpha.php * @param resource $image * @param int $red

* Value of red component. @@ -1438,8 +1623,9 @@ function gd_color_exact ($image, $red, $green, $blue) * 0 indicates completely opaque while * 127 indicates completely transparent. *

- * @return int the index of the specified color+alpha in the palette of the - * image, or -1 if the color does not exist in the image's palette. + * @return int|false the index of the specified color+alpha in the palette of the + * image, -1 if the color does not exist in the image's palette, or FALSE + * on failure * @since 4.0.6 * @since 5.0 */ @@ -1450,7 +1636,7 @@ function gd_color_exact_alpha ($image, $red, $green, $blue, $alpha) /** * Makes the colors of the palette version of an image more closely match the true color version - * @link http://php.net/manual/en/function.imagecolormatch.php + * @link https://php.net/manual/en/function.imagecolormatch.php * @param $image1 resource

* A truecolor image link resource. *

@@ -1467,12 +1653,12 @@ function gd_color_match ($image1, $image2) /** * Get the index of the specified color or its closest possible alternative - * @link http://php.net/manual/en/function.imagecolorresolve.php + * @link https://php.net/manual/en/function.imagecolorresolve.php * @param resource $image * @param int $red

Value of red component.

* @param int $green

Value of green component.

* @param int $blue

Value of blue component.

- * @return int a color index. + * @return int|false a color index or FALSE on failure * @since 4.0 * @since 5.0 */ @@ -1483,7 +1669,7 @@ function gd_color_resolve ($image, $red, $green, $blue) /** * Get the index of the specified color + alpha or its closest possible alternative - * @link http://php.net/manual/en/function.imagecolorresolvealpha.php + * @link https://php.net/manual/en/function.imagecolorresolvealpha.php * @param resource $image * @param int $red

* Value of red component. @@ -1499,7 +1685,7 @@ function gd_color_resolve ($image, $red, $green, $blue) * 0 indicates completely opaque while * 127 indicates completely transparent. *

- * @return int a color index. + * @return int|false a color index or FALSE on failure * @since 4.0.6 * @since 5.0 */ @@ -1510,7 +1696,7 @@ function gd_color_resolve_alpha ($image, $red, $green, $blue, $alpha) /** * Set the color for the specified palette index - * @link http://php.net/manual/en/function.imagecolorset.php + * @link https://php.net/manual/en/function.imagecolorset.php * @param resource $image * @param int $index

* An index in the palette. @@ -1532,13 +1718,13 @@ function gd_color_set ($image, $index, $red, $green, $blue, $alpha = 0) /** * Get the colors for an index - * @link http://php.net/manual/en/function.imagecolorsforindex.php + * @link https://php.net/manual/en/function.imagecolorsforindex.php * @param resource $image * @param int $index

* The color index. *

- * @return array an associative array with red, green, blue and alpha keys that - * contain the appropriate values for the specified color index. + * @return array|false an associative array with red, green, blue and alpha keys that + * contain the appropriate values for the specified color index or FALSE on failure * @since 4.0 * @since 5.0 */ @@ -1549,13 +1735,13 @@ function gd_colors_for_index ($image, $index) /** * Find out the number of colors in an image's palette - * @link http://php.net/manual/en/function.imagecolorstotal.php + * @link https://php.net/manual/en/function.imagecolorstotal.php * @param resource $image

* An image resource, returned by one of the image creation functions, such * as imagecreatefromgif. *

- * @return int the number of colors in the specified image's palette or 0 for - * truecolor images. + * @return int|false the number of colors in the specified image's palette, 0 for + * truecolor images, or FALSE on failure * @since 4.0 * @since 5.0 */ @@ -1566,16 +1752,16 @@ function gd_colors_total ($image) /** * Define a color as transparent - * @link http://php.net/manual/en/function.imagecolortransparent.php + * @link https://php.net/manual/en/function.imagecolortransparent.php * @param resource $image * @param int $color [optional]

* A color identifier created with * imagecolorallocate. *

- * @return int The identifier of the new (or current, if none is specified) + * @return int|false The identifier of the new (or current, if none is specified) * transparent color is returned. If color * is not specified, and the image has no transparent color, the - * returned identifier will be -1. + * returned identifier will be -1. If an error occurs, FALSE is returned. * @since 4.0 * @since 5.0 */ @@ -1586,7 +1772,7 @@ function gd_color_transparent ($image, $color = null) /** * Apply a 3x3 convolution matrix, using coefficient and offset - * @link http://php.net/manual/en/function.imageconvolution.php + * @link https://php.net/manual/en/function.imageconvolution.php * @param resource $image * @param array $matrix

* A 3x3 matrix: an array of three arrays of three floats. @@ -1607,7 +1793,7 @@ function gd_convolution ($image, array $matrix, $div, $offset) /** * Copy part of an image - * @link http://php.net/manual/en/function.imagecopy.php + * @link https://php.net/manual/en/function.imagecopy.php * @param resource $dst_im

* Destination image link resource. *

@@ -1643,7 +1829,7 @@ function gd_copy ($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src /** * Copy and merge part of an image - * @link http://php.net/manual/en/function.imagecopymerge.php + * @link https://php.net/manual/en/function.imagecopymerge.php * @param resource $dst_im

* Destination image link resource. *

@@ -1686,7 +1872,7 @@ function gd_copy_merge ($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w /** * Copy and merge part of an image with gray scale - * @link http://php.net/manual/en/function.imagecopymergegray.php + * @link https://php.net/manual/en/function.imagecopymergegray.php * @param resource $dst_im

* Destination image link resource. *

@@ -1729,7 +1915,7 @@ function gd_copy_merge_gray ($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $ /** * Copy and resize part of an image with resampling - * @link http://php.net/manual/en/function.imagecopyresampled.php + * @link https://php.net/manual/en/function.imagecopyresampled.php * @param resource $dst_image * @param resource $src_image * @param int $dst_x

@@ -1767,7 +1953,7 @@ function gd_copy_resampled ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src /** * Copy and resize part of an image - * @link http://php.net/manual/en/function.imagecopyresized.php + * @link https://php.net/manual/en/function.imagecopyresized.php * @param resource $dst_image * @param resource $src_image * @param int $dst_x

@@ -1805,14 +1991,14 @@ function gd_copy_resized ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y /** * Create a new palette based image - * @link http://php.net/manual/en/function.imagecreate.php + * @link https://php.net/manual/en/function.imagecreate.php * @param int $width

* The image width. *

* @param int $height

* The image height. *

- * @return resource an image resource identifier on success, false on errors. + * @return resource|false an image resource identifier on success, false on errors. * @since 4.0 * @since 5.0 */ @@ -1823,11 +2009,11 @@ function gd_create ($width, $height) /** * Create a new image from GD2 file or URL - * @link http://php.net/manual/en/function.imagecreatefromgd2.php + * @link https://php.net/manual/en/function.imagecreatefromgd2.php * @param string $filename

* Path to the GD2 image. *

- * @return resource an image resource identifier on success, false on errors. + * @return resource|false an image resource identifier on success, false on errors. * @since 4.0.7 * @since 5.0 */ @@ -1838,7 +2024,7 @@ function gd_create_from_gd2 ($filename) /** * Create a new image from a given part of GD2 file or URL - * @link http://php.net/manual/en/function.imagecreatefromgd2part.php + * @link https://php.net/manual/en/function.imagecreatefromgd2part.php * @param string $filename

* Path to the GD2 image. *

@@ -1854,7 +2040,7 @@ function gd_create_from_gd2 ($filename) * @param int $height

* Source height. *

- * @return resource an image resource identifier on success, false on errors. + * @return resource|false an image resource identifier on success, false on errors. * @since 4.0.7 * @since 5.0 */ @@ -1865,11 +2051,11 @@ function gd_create_from_gd2_part ($filename, $srcX, $srcY, $width, $height) /** * Create a new image from GD file or URL - * @link http://php.net/manual/en/function.imagecreatefromgd.php + * @link https://php.net/manual/en/function.imagecreatefromgd.php * @param string $filename

* Path to the GD file. *

- * @return resource an image resource identifier on success, false on errors. + * @return resource|false an image resource identifier on success, false on errors. * @since 4.0.7 * @since 5.0 */ @@ -1880,11 +2066,11 @@ function gd_create_from_gd ($filename) /** * Create a new image from file or URL - * @link http://php.net/manual/en/function.imagecreatefromgif.php + * @link https://php.net/manual/en/function.imagecreatefromgif.php * @param string $filename

* Path to the GIF image. *

- * @return resource an image resource identifier on success, false on errors. + * @return resource|false an image resource identifier on success, false on errors. * @since 4.0 * @since 5.0 */ @@ -1895,11 +2081,11 @@ function gd_create_from_gif ($filename) /** * Create a new image from file or URL - * @link http://php.net/manual/en/function.imagecreatefromjpeg.php + * @link https://php.net/manual/en/function.imagecreatefromjpeg.php * @param string $filename

* Path to the JPEG image. *

- * @return resource an image resource identifier on success, false on errors. + * @return resource|false an image resource identifier on success, false on errors. * @since 4.0 * @since 5.0 */ @@ -1910,11 +2096,11 @@ function gd_create_from_jpeg ($filename) /** * Create a new image from file or URL - * @link http://php.net/manual/en/function.imagecreatefrompng.php + * @link https://php.net/manual/en/function.imagecreatefrompng.php * @param string $filename

* Path to the PNG image. *

- * @return resource an image resource identifier on success, false on errors. + * @return resource|false an image resource identifier on success, false on errors. * @since 4.0 * @since 5.0 */ @@ -1925,11 +2111,11 @@ function gd_create_from_png ($filename) /** * Create a new image from the image stream in the string - * @link http://php.net/manual/en/function.imagecreatefromstring.php + * @link https://php.net/manual/en/function.imagecreatefromstring.php * @param string $image

* A string containing the image data. *

- * @return resource An image resource will be returned on success. FALSE is returned if + * @return resource|false An image resource will be returned on success. FALSE is returned if * the image type is unsupported, the data is not in a recognised format, * or the image is corrupt and cannot be loaded. * @since 4.0.4 @@ -1942,11 +2128,11 @@ function gd_create_from_string ($image) /** * Create a new image from file or URL - * @link http://php.net/manual/en/function.imagecreatefromwbmp.php + * @link https://php.net/manual/en/function.imagecreatefromwbmp.php * @param string $filename

* Path to the WBMP image. *

- * @return resource an image resource identifier on success, false on errors. + * @return resource|false an image resource identifier on success, false on errors. * @since 4.0.1 * @since 5.0 */ @@ -1957,11 +2143,25 @@ function gd_create_from_wbmp ($filename) /** * Create a new image from file or URL - * @link http://php.net/manual/en/function.imagecreatefromxbm.php + * @link https://php.net/manual/en/function.imagecreatefromwebp.php + * @param string $filename

+ * Path to the WebP image. + *

+ * @return resource|false an image resource identifier on success, false on errors. + * @since 5.4.0 + */ +function gd_create_from_webp ($filename) +{ + return imagecreatefromwebp($filename); +} + +/** + * Create a new image from file or URL + * @link https://php.net/manual/en/function.imagecreatefromxbm.php * @param string $filename

* Path to the XBM image. *

- * @return resource an image resource identifier on success, false on errors. + * @return resource|false an image resource identifier on success, false on errors. * @since 4.0.1 * @since 5.0 */ @@ -1972,11 +2172,11 @@ function gd_create_from_xbm ($filename) /** * Create a new image from file or URL - * @link http://php.net/manual/en/function.imagecreatefromxpm.php + * @link https://php.net/manual/en/function.imagecreatefromxpm.php * @param string $filename

* Path to the XPM image. *

- * @return resource an image resource identifier on success, false on errors. + * @return resource|false an image resource identifier on success, false on errors. * @since 4.0.1 * @since 5.0 */ @@ -1987,14 +2187,14 @@ function gd_create_from_xpm ($filename) /** * Create a new true color image - * @link http://php.net/manual/en/function.imagecreatetruecolor.php + * @link https://php.net/manual/en/function.imagecreatetruecolor.php * @param int $width

* Image width. *

* @param int $height

* Image height. *

- * @return resource an image resource identifier on success, false on errors. + * @return resource|false an image resource identifier on success, false on errors. * @since 4.0.6 * @since 5.0 */ @@ -2005,9 +2205,9 @@ function gd_create_true_color ($width, $height) /** * Crop an image using the given coordinates and size, x, y, width and height - * @link http://www.php.net/manual/en/function.imagecrop.php + * @link https://secure.php.net/manual/en/function.imagecrop.php * @param resource $image

- * An image resource, returned by one of the image creation functions, such as {@link http://www.php.net/manual/en/function.imagecreatetruecolor.php imagecreatetruecolor()}. + * An image resource, returned by one of the image creation functions, such as {@link https://secure.php.net/manual/en/function.imagecreatetruecolor.php imagecreatetruecolor()}. *

* @param array $rect

Array with keys "x", "y", "width" and "height".

* @return resource|bool Return cropped image resource on success or FALSE on failure. @@ -2020,9 +2220,9 @@ function gd_crop ($image, $rect) /** * Crop an image automatically using one of the available modes - * @link http://www.php.net/manual/en/function.imagecropauto.php + * @link https://secure.php.net/manual/en/function.imagecropauto.php * @param resource $image

- * An image resource, returned by one of the image creation functions, such as {@link http://www.php.net/manual/en/function.imagecreatetruecolor.php imagecreatetruecolor()}. + * An image resource, returned by one of the image creation functions, such as {@link https://secure.php.net/manual/en/function.imagecreatetruecolor.php imagecreatetruecolor()}. *

* @param int $mode [optional]

* One of IMG_CROP_* constants. @@ -2044,7 +2244,7 @@ function gd_crop_auto ($image, $mode = -1, $threshold = .5, $color = -1) /** * Draw a dashed line - * @link http://php.net/manual/en/function.imagedashedline.php + * @link https://php.net/manual/en/function.imagedashedline.php * @param resource $image * @param int $x1

* Upper left x coordinate. @@ -2062,9 +2262,10 @@ function gd_crop_auto ($image, $mode = -1, $threshold = .5, $color = -1) * The fill color. A color identifier created with * imagecolorallocate. *

- * @return bool Always returns true + * @return bool TRUE on success or FALSE on failure. * @since 4.0 * @since 5.0 + * @deprecated Use combination of imagesetstyle() and imageline() instead */ function gd_dashed_line ($image, $x1, $y1, $x2, $y2, $color) { @@ -2073,7 +2274,7 @@ function gd_dashed_line ($image, $x1, $y1, $x2, $y2, $color) /** * Destroy an image - * @link http://php.net/manual/en/function.imagedestroy.php + * @link https://php.net/manual/en/function.imagedestroy.php * @param resource $image * @return bool true on success or false on failure. * @since 4.0 @@ -2086,7 +2287,7 @@ function gd_destroy ($image) /** * Draw an ellipse - * @link http://php.net/manual/en/function.imageellipse.php + * @link https://php.net/manual/en/function.imageellipse.php * @param resource $image * @param int $cx

* x-coordinate of the center. @@ -2115,7 +2316,7 @@ function gd_ellipse ($image, $cx, $cy, $width, $height, $color) /** * Flood fill - * @link http://php.net/manual/en/function.imagefill.php + * @link https://php.net/manual/en/function.imagefill.php * @param resource $image * @param int $x

* x-coordinate of start point. @@ -2138,7 +2339,7 @@ function gd_fill ($image, $x, $y, $color) /** * Draw a partial arc and fill it - * @link http://php.net/manual/en/function.imagefilledarc.php + * @link https://php.net/manual/en/function.imagefilledarc.php * @param resource $image * @param int $cx

* x-coordinate of the center. @@ -2178,7 +2379,7 @@ function gd_filled_arc ($image, $cx, $cy, $width, $height, $start, $end, $color, /** * Draw a filled ellipse - * @link http://php.net/manual/en/function.imagefilledellipse.php + * @link https://php.net/manual/en/function.imagefilledellipse.php * @param resource $image * @param int $cx

* x-coordinate of the center. @@ -2207,7 +2408,7 @@ function gd_filled_ellipse ($image, $cx, $cy, $width, $height, $color) /** * Draw a filled polygon - * @link http://php.net/manual/en/function.imagefilledpolygon.php + * @link https://php.net/manual/en/function.imagefilledpolygon.php * @param resource $image * @param array $points

* An array containing the x and y @@ -2231,7 +2432,7 @@ function gd_filled_polygon ($image, array $points, $num_points, $color) /** * Draw a filled rectangle - * @link http://php.net/manual/en/function.imagefilledrectangle.php + * @link https://php.net/manual/en/function.imagefilledrectangle.php * @param resource $image * @param int $x1

* x-coordinate for point 1. @@ -2260,7 +2461,7 @@ function gd_filled_rectangle ($image, $x1, $y1, $x2, $y2, $color) /** * Flood fill to specific color - * @link http://php.net/manual/en/function.imagefilltoborder.php + * @link https://php.net/manual/en/function.imagefilltoborder.php * @param resource $image * @param int $x

* x-coordinate of start. @@ -2287,7 +2488,7 @@ function gd_fill_to_border ($image, $x, $y, $border, $color) /** * Applies a filter to an image - * @link http://php.net/manual/en/function.imagefilter.php + * @link https://php.net/manual/en/function.imagefilter.php * @param resource $image * @param int $filtertype

* filtertype can be one of the following: @@ -2312,9 +2513,9 @@ function gd_filter ($image, $filtertype, $arg1 = null, $arg2 = null, $arg3 = nul /** * Flips an image using a given mode - * @link http://www.php.net/manual/en/function.imageflip.php + * @link https://secure.php.net/manual/en/function.imageflip.php * @param resource $image

- * An image resource, returned by one of the image creation functions, such as {@link http://www.php.net/manual/en/function.imagecreatetruecolor.php imagecreatetruecolor()}. + * An image resource, returned by one of the image creation functions, such as {@link https://secure.php.net/manual/en/function.imagecreatetruecolor.php imagecreatetruecolor()}. *

* @param int $mode

* Flip mode, this can be one of the IMG_FLIP_* constants: @@ -2356,7 +2557,7 @@ function gd_flip ($image, $mode) /** * Get font height - * @link http://php.net/manual/en/function.imagefontheight.php + * @link https://php.net/manual/en/function.imagefontheight.php * @param int $font * @return int the height of the pixel. * @since 4.0 @@ -2369,7 +2570,7 @@ function gd_font_height ($font) /** * Get font width - * @link http://php.net/manual/en/function.imagefontwidth.php + * @link https://php.net/manual/en/function.imagefontwidth.php * @param int $font * @return int the width of the pixel * @since 4.0 @@ -2382,7 +2583,7 @@ function gd_font_width ($font) /** * Give the bounding box of a text using fonts via freetype2 - * @link http://php.net/manual/en/function.imageftbbox.php + * @link https://php.net/manual/en/function.imageftbbox.php * @param float $size

* The font size. Depending on your version of GD, this should be * specified as the pixel size (GD1) or point size (GD2). @@ -2415,7 +2616,7 @@ function gd_font_width ($font) * * *

- * @return array imageftbbox returns an array with 8 + * @return array|false imageftbbox returns an array with 8 * elements representing four points making the bounding box of the * text: * @@ -2455,6 +2656,7 @@ function gd_font_width ($font) * The points are relative to the text regardless of the * angle, so "upper left" means in the top left-hand * corner seeing the text horizontally. + * Returns false on error. * @since 4.0.7 * @since 5.0 */ @@ -2465,7 +2667,7 @@ function gd_ft_bbox ($size, $angle, $fontfile, $text, $extrainfo = null ) /** * Write text to the image using fonts using FreeType 2 - * @link http://php.net/manual/en/function.imagefttext.php + * @link https://php.net/manual/en/function.imagefttext.php * @param resource $image * @param float $size

* The font size to use in points. @@ -2532,7 +2734,7 @@ function gd_ft_bbox ($size, $angle, $fontfile, $text, $extrainfo = null ) * * *

- * @return array This function returns an array defining the four points of the box, starting in the lower left and moving counter-clockwise: + * @return array|false This function returns an array defining the four points of the box, starting in the lower left and moving counter-clockwise: * * 0 * lower left x-coordinate @@ -2565,6 +2767,7 @@ function gd_ft_bbox ($size, $angle, $fontfile, $text, $extrainfo = null ) * 7 * upper left y-coordinate * + * Returns false on error. * @since 4.0.7 * @since 5.0 */ @@ -2575,7 +2778,7 @@ function gd_ft_text ($image, $size, $angle, $x, $y, $color, $fontfile, $text, $e /** * Apply a gamma correction to a GD image - * @link http://php.net/manual/en/function.imagegammacorrect.php + * @link https://php.net/manual/en/function.imagegammacorrect.php * @param resource $image * @param float $inputgamma

* The input gamma. @@ -2594,7 +2797,7 @@ function gd_gamma_correct ($image, $inputgamma, $outputgamma) /** * Output GD2 image to browser or file - * @link http://php.net/manual/en/function.imagegd2.php + * @link https://php.net/manual/en/function.imagegd2.php * @param resource $image * @param string $filename [optional]

* The path to save the file to. If not set or &null;, the raw image stream @@ -2619,7 +2822,7 @@ function gd_raw2 ($image, $filename = null, $chunk_size = null, $type = null) /** * Output GD image to browser or file - * @link http://php.net/manual/en/function.imagegd.php + * @link https://php.net/manual/en/function.imagegd.php * @param resource $image * @param string $filename [optional]

* The path to save the file to. If not set or &null;, the raw image stream @@ -2636,7 +2839,7 @@ function gd_raw ($image, $filename = null) /** * Output image to browser or file - * @link http://php.net/manual/en/function.imagegif.php + * @link https://php.net/manual/en/function.imagegif.php * @param resource $image * @param string $filename [optional]

* The path to save the file to. If not set or &null;, the raw image stream @@ -2653,13 +2856,14 @@ function gd_gif ($image, $filename = null) /** * Enable or disable interlace - * @link http://php.net/manual/en/function.imageinterlace.php + * @link https://php.net/manual/en/function.imageinterlace.php * @param resource $image * @param int $interlace [optional]

* If non-zero, the image will be interlaced, else the interlace bit is * turned off. *

- * @return int 1 if the interlace bit is set for the image, 0 otherwise. + * @return int|false 1 if the interlace bit is set for the image, + * 0 if it is not, or FALSE on failure * @since 4.0 * @since 5.0 */ @@ -2670,7 +2874,7 @@ function gd_interlace ($image, $interlace = null) /** * Finds whether an image is a truecolor image - * @link http://php.net/manual/en/function.imageistruecolor.php + * @link https://php.net/manual/en/function.imageistruecolor.php * @param resource $image * @return bool true if the image is truecolor, false * otherwise. @@ -2684,7 +2888,7 @@ function gd_is_true_color ($image) /** * Output image to browser or file - * @link http://php.net/manual/en/function.imagejpeg.php + * @link https://php.net/manual/en/function.imagejpeg.php * @param resource $image * @param string $filename [optional]

* The path to save the file to. If not set or &null;, the raw image stream @@ -2710,7 +2914,7 @@ function gd_jpeg ($image, $filename = null, $quality = null) /** * Set the alpha blending flag to use the bundled libgd layering effects - * @link http://php.net/manual/en/function.imagelayereffect.php + * @link https://php.net/manual/en/function.imagelayereffect.php * @param resource $image * @param int $effect

* One of the following constants: @@ -2728,7 +2932,7 @@ function gd_layer_effect ($image, $effect) /** * Draw a line - * @link http://php.net/manual/en/function.imageline.php + * @link https://php.net/manual/en/function.imageline.php * @param resource $image * @param int $x1

* x-coordinate for first point. @@ -2757,7 +2961,7 @@ function gd_line ($image, $x1, $y1, $x2, $y2, $color) /** * Load a new font - * @link http://php.net/manual/en/function.imageloadfont.php + * @link https://php.net/manual/en/function.imageloadfont.php * @param string $file

* The font file format is currently binary and architecture * dependent. This means you should generate the font files on the @@ -2803,7 +3007,7 @@ function gd_line ($image, $x1, $y1, $x2, $y2, $color) * * *

- * @return int The font identifier which is always bigger than 5 to avoid conflicts with + * @return int|false The font identifier which is always bigger than 5 to avoid conflicts with * built-in fonts or false on errors. * @since 4.0 * @since 5.0 @@ -2815,7 +3019,7 @@ function gd_load_font ($file) /** * Copy the palette from one image to another - * @link http://php.net/manual/en/function.imagepalettecopy.php + * @link https://php.net/manual/en/function.imagepalettecopy.php * @param resource $destination

* The destination image resource. *

@@ -2833,9 +3037,9 @@ function gd_palette_copy ($destination, $source) /** * Converts a palette based image to true color - * @link http://www.php.net/manual/en/function.imagepalettetotruecolor.php + * @link https://secure.php.net/manual/en/function.imagepalettetotruecolor.php * @param resource $image

- * An image resource, returnd by one of the image creation functions, such as {@link http://www.php.net/manual/en/function.imagecreatetruecolor.php imagecreatetruecolor()}. + * An image resource, returnd by one of the image creation functions, such as {@link https://secure.php.net/manual/en/function.imagecreatetruecolor.php imagecreatetruecolor()}. *

* @return bool Returns TRUE if the convertion was complete, or if the source image already is a true color image, otherwise FALSE is returned. * @since 5.5.0 @@ -2847,7 +3051,7 @@ function gd_palette_to_true_color ($image) /** * Output a PNG image to either the browser or a file - * @link http://php.net/manual/en/function.imagepng.php + * @link https://php.net/manual/en/function.imagepng.php * @param resource $image * @param string $filename [optional]

* The path to save the file to. If not set or &null;, the raw image stream @@ -2878,7 +3082,7 @@ function gd_png ($image, $filename = null, $quality = null, $filters = null) /** * Draws a polygon - * @link http://php.net/manual/en/function.imagepolygon.php + * @link https://php.net/manual/en/function.imagepolygon.php * @param resource $image * @param array $points

* An array containing the polygon's vertices, e.g.: @@ -2917,7 +3121,7 @@ function gd_polygon ($image, array $points, $num_points, $color) /** * Give the bounding box of a text rectangle using PostScript Type1 fonts - * @link http://php.net/manual/en/function.imagepsbbox.php + * @link https://php.net/manual/en/function.imagepsbbox.php * @param string $text

* The text to be written. *

@@ -2925,7 +3129,7 @@ function gd_polygon ($image, array $points, $num_points, $color) * @param int $size

* size is expressed in pixels. *

- * @return array an array containing the following elements: + * @return array|false an array containing the following elements: * * 0 * left x-coordinate @@ -2942,8 +3146,10 @@ function gd_polygon ($image, array $points, $num_points, $color) * 3 * lower y-coordinate * + * Returns false on error. * @since 4.0 * @since 5.0 + * @deprecated 7.0.0 This function was REMOVED in PHP 7.0.0. */ function gd_ps_bbox ($text, $font, $size) { @@ -2952,7 +3158,7 @@ function gd_ps_bbox ($text, $font, $size) /** * Change the character encoding vector of a font - * @link http://php.net/manual/en/function.imagepsencodefont.php + * @link https://php.net/manual/en/function.imagepsencodefont.php * @param resource $font_index

* A font resource, returned by imagepsloadfont. *

@@ -2965,6 +3171,7 @@ function gd_ps_bbox ($text, $font, $size) * @return bool true on success or false on failure. * @since 4.0 * @since 5.0 + * @deprecated 7.0.0 This function was REMOVED in PHP 7.0.0. */ function gd_ps_encode_font ($font_index, $encodingfile) { @@ -2973,7 +3180,7 @@ function gd_ps_encode_font ($font_index, $encodingfile) /** * Extend or condense a font - * @link http://php.net/manual/en/function.imagepsextendfont.php + * @link https://php.net/manual/en/function.imagepsextendfont.php * @param resource $font_index

* A font resource, returned by imagepsloadfont. *

@@ -2983,6 +3190,7 @@ function gd_ps_encode_font ($font_index, $encodingfile) * @return bool true on success or false on failure. * @since 4.0 * @since 5.0 + * @deprecated 7.0.0 This function was REMOVED in PHP 7.0.0. */ function gd_ps_extend_font ($font_index, $extend) { @@ -2991,13 +3199,14 @@ function gd_ps_extend_font ($font_index, $extend) /** * Free memory used by a PostScript Type 1 font - * @link http://php.net/manual/en/function.imagepsfreefont.php + * @link https://php.net/manual/en/function.imagepsfreefont.php * @param resource $font_index

* A font resource, returned by imagepsloadfont. *

* @return bool true on success or false on failure. * @since 4.0 * @since 5.0 + * @deprecated 7.0.0 This function was REMOVED in PHP 7.0.0. */ function gd_ps_free_font ($font_index) { @@ -3006,14 +3215,15 @@ function gd_ps_free_font ($font_index) /** * Load a PostScript Type 1 font from file - * @link http://php.net/manual/en/function.imagepsloadfont.php + * @link https://php.net/manual/en/function.imagepsloadfont.php * @param string $filename

* Path to the Postscript font file. *

- * @return resource In the case everything went right, a valid font index will be returned and + * @return resource|false In the case everything went right, a valid font index will be returned and * can be used for further purposes. Otherwise the function returns false. * @since 4.0 * @since 5.0 + * @deprecated 7.0.0 This function was REMOVED in PHP 7.0.0. */ function gd_ps_load_font ($filename) { @@ -3022,7 +3232,7 @@ function gd_ps_load_font ($filename) /** * Slant a font - * @link http://php.net/manual/en/function.imagepsslantfont.php + * @link https://php.net/manual/en/function.imagepsslantfont.php * @param resource $font_index

* A font resource, returned by imagepsloadfont. *

@@ -3032,6 +3242,7 @@ function gd_ps_load_font ($filename) * @return bool true on success or false on failure. * @since 4.0 * @since 5.0 + * @deprecated 7.0.0 This function was REMOVED in PHP 7.0.0. */ function gd_ps_slant_font ($font_index, $slant) { @@ -3040,7 +3251,7 @@ function gd_ps_slant_font ($font_index, $slant) /** * Draws a text over an image using PostScript Type1 fonts - * @link http://php.net/manual/en/function.imagepstext.php + * @link https://php.net/manual/en/function.imagepstext.php * @param resource $image * @param string $text

* The text to be written. @@ -3089,7 +3300,7 @@ function gd_ps_slant_font ($font_index, $slant) * quite visible. With bigger sizes, use 4. It's less computationally * intensive. *

- * @return array This function returns an array containing the following elements: + * @return array|false This function returns an array containing the following elements: * * 0 * lower left x-coordinate @@ -3106,8 +3317,10 @@ function gd_ps_slant_font ($font_index, $slant) * 3 * upper right y-coordinate * + * Returns false on error. * @since 4.0 * @since 5.0 + * @deprecated 7.0.0 This function was REMOVED in PHP 7.0.0. */ function gd_ps_text ($image, $text, $font_index, $size, $foreground, $background, $x, $y, $space = null, $tightness = null, $angle = null, $antialias_steps = null) { @@ -3116,7 +3329,7 @@ function gd_ps_text ($image, $text, $font_index, $size, $foreground, $background /** * Draw a rectangle - * @link http://php.net/manual/en/function.imagerectangle.php + * @link https://php.net/manual/en/function.imagerectangle.php * @param resource $image * @param int $x1

* Upper left x coordinate. @@ -3146,7 +3359,7 @@ function gd_rectangle ($image, $x1, $y1, $x2, $y2, $color) /** * Rotate an image with a given angle - * @link http://php.net/manual/en/function.imagerotate.php + * @link https://php.net/manual/en/function.imagerotate.php * @param resource $image * @param float $angle

* Rotation angle, in degrees. @@ -3157,7 +3370,7 @@ function gd_rectangle ($image, $x1, $y1, $x2, $y2, $color) * @param int $ignore_transparent [optional]

* If set and non-zero, transparent colors are ignored (otherwise kept). *

- * @return resource + * @return resource|false the rotated image or FALSE on failure * @since 4.3.0 * @since 5.0 */ @@ -3168,7 +3381,7 @@ function gd_rotate ($image, $angle, $bgd_color, $ignore_transparent = null) /** * Set the flag to save full alpha channel information (as opposed to single-color transparency) when saving PNG images - * @link http://php.net/manual/en/function.imagesavealpha.php + * @link https://php.net/manual/en/function.imagesavealpha.php * @param resource $image * @param bool $saveflag

* Whether to save the alpha channel or not. Default to false. @@ -3182,9 +3395,27 @@ function gd_save_alpha ($image, $saveflag) return imagesavealpha($image, $saveflag); } +/** + * @since 5.5.0 + * Scale an image using the given new width and height + * @link https://secure.php.net/manual/en/function.imagescale.php + * @param resource $image

+ * An image resource, returnd by one of the image creation functions, such as {@link https://secure.php.net/manual/en/function.imagecreatetruecolor.php imagecreatetruecolor()}. + *

+ * @param int $new_width + * @param int $new_height [optional] + * @param int $mode [optional] One of IMG_NEAREST_NEIGHBOUR, IMG_BILINEAR_FIXED, IMG_BICUBIC, IMG_BICUBIC_FIXED or anything else (will use two pass). + * @return resource|bool Return scaled image resource on success or FALSE on failure. + */ + +function gd_scale ($image, $new_width, $new_height = -1, $mode = IMG_BILINEAR_FIXED) +{ + return imagescale($image, $new_width, $new_height, $mode); +} + /** * Set the brush image for line drawing - * @link http://php.net/manual/en/function.imagesetbrush.php + * @link https://php.net/manual/en/function.imagesetbrush.php * @param resource $image * @param resource $brush

* An image resource. @@ -3200,9 +3431,9 @@ function gd_set_brush ($image, $brush) /** * Set the interpolation method - * @link http://www.php.net/manual/en/function.imagesetinterpolation.php + * @link https://secure.php.net/manual/en/function.imagesetinterpolation.php * @param resource $image

- * An image resource, returned by one of the image creation functions, such as {@link http://www.php.net/manual/en/function.imagecreatetruecolor.php imagecreatetruecolor()}. + * An image resource, returned by one of the image creation functions, such as {@link https://secure.php.net/manual/en/function.imagecreatetruecolor.php imagecreatetruecolor()}. *

* @param int $method

* The interpolation method, which can be one of the following: @@ -3282,7 +3513,7 @@ function gd_set_interpolation ($image, $method = IMG_BILINEAR_FIXED) /** * Set a single pixel - * @link http://php.net/manual/en/function.imagesetpixel.php + * @link https://php.net/manual/en/function.imagesetpixel.php * @param resource $image * @param int $x

* x-coordinate. @@ -3305,7 +3536,7 @@ function gd_set_pixel ($image, $x, $y, $color) /** * Set the style for line drawing - * @link http://php.net/manual/en/function.imagesetstyle.php + * @link https://php.net/manual/en/function.imagesetstyle.php * @param resource $image * @param array $style

* An array of pixel colors. You can use the @@ -3323,7 +3554,7 @@ function gd_set_style ($image, array $style) /** * Set the thickness for line drawing - * @link http://php.net/manual/en/function.imagesetthickness.php + * @link https://php.net/manual/en/function.imagesetthickness.php * @param resource $image * @param int $thickness

* Thickness, in pixels. @@ -3339,7 +3570,7 @@ function gd_set_thickness ($image, $thickness) /** * Set the tile image for filling - * @link http://php.net/manual/en/function.imagesettile.php + * @link https://php.net/manual/en/function.imagesettile.php * @param resource $image * @param resource $tile

* The image resource to be used as a tile. @@ -3355,7 +3586,7 @@ function gd_set_tile ($image, $tile) /** * Draw a string horizontally - * @link http://php.net/manual/en/function.imagestring.php + * @link https://php.net/manual/en/function.imagestring.php * @param resource $image * @param int $font * @param int $x

@@ -3382,7 +3613,7 @@ function gd_string ($image, $font, $x, $y, $string, $color) /** * Draw a string vertically - * @link http://php.net/manual/en/function.imagestringup.php + * @link https://php.net/manual/en/function.imagestringup.php * @param resource $image * @param int $font * @param int $x

@@ -3409,9 +3640,9 @@ function gd_string_up ($image, $font, $x, $y, $string, $color) /** * Get image width - * @link http://php.net/manual/en/function.imagesx.php + * @link https://php.net/manual/en/function.imagesx.php * @param resource $image - * @return int Return the width of the image or false on + * @return int|false Return the width of the image or false on * errors. * @since 4.0 * @since 5.0 @@ -3423,9 +3654,9 @@ function gd_width ($image) /** * Get image height - * @link http://php.net/manual/en/function.imagesy.php + * @link https://php.net/manual/en/function.imagesy.php * @param resource $image - * @return int Return the height of the image or false on + * @return int|false Return the height of the image or false on * errors. * @since 4.0 * @since 5.0 @@ -3437,7 +3668,7 @@ function gd_height ($image) /** * Convert a true color image to a palette image - * @link http://php.net/manual/en/function.imagetruecolortopalette.php + * @link https://php.net/manual/en/function.imagetruecolortopalette.php * @param resource $image * @param bool $dither

* Indicates if the image should be dithered - if it is true then @@ -3458,7 +3689,7 @@ function gd_true_color_to_palette ($image, $dither, $ncolors) /** * Give the bounding box of a text using TrueType fonts - * @link http://php.net/manual/en/function.imagettfbbox.php + * @link https://php.net/manual/en/function.imagettfbbox.php * @param float $size

* The font size. Depending on your version of GD, this should be * specified as the pixel size (GD1) or point size (GD2). @@ -3475,7 +3706,7 @@ function gd_true_color_to_palette ($image, $dither, $ncolors) * @param string $text

* The string to be measured. *

- * @return array imagettfbbox returns an array with 8 + * @return array|false imagettfbbox returns an array with 8 * elements representing four points making the bounding box of the * text on success and false on error. * @@ -3529,7 +3760,7 @@ function gd_ttf_bbox ($size, $angle, $fontfile, $text) /** * Write text to the image using TrueType fonts - * @link http://php.net/manual/en/function.imagettftext.php + * @link https://php.net/manual/en/function.imagettftext.php * @param resource $image * @param float $size

* The font size. Depending on your version of GD, this should be @@ -3598,7 +3829,7 @@ function gd_ttf_bbox ($size, $angle, $fontfile, $text) * If a character is used in the string which is not supported by the * font, a hollow rectangle will replace the character. *

- * @return array an array with 8 elements representing four points making the + * @return array|false an array with 8 elements representing four points making the * bounding box of the text. The order of the points is lower left, lower * right, upper right, upper left. The points are relative to the text * regardless of the angle, so "upper left" means in the top left-hand @@ -3614,12 +3845,10 @@ function gd_ttf_text ($image, $size, $angle, $x, $y, $color, $fontfile, $text) /** * Return the image types supported by this PHP build - * @link http://php.net/manual/en/function.imagetypes.php + * @link https://php.net/manual/en/function.imagetypes.php * @return int a bit-field corresponding to the image formats supported by the * version of GD linked into PHP. The following bits are returned, - * IMG_GIF | IMG_JPG | - * IMG_PNG | IMG_WBMP | - * IMG_XPM. + * IMG_BMP | IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM | IMG_WEBP * @since 4.0.2 * @since 5.0 */ @@ -3630,7 +3859,7 @@ function gd_types () /** * Output image to browser or file - * @link http://php.net/manual/en/function.imagewbmp.php + * @link https://php.net/manual/en/function.imagewbmp.php * @param resource $image * @param string $filename [optional]

* The path to save the file to. If not set or &null;, the raw image stream @@ -3652,7 +3881,7 @@ function gd_wbmp ($image, $filename = null, $foreground = null) /** * Output a WebP image to browser or file - * @link http://php.net/manual/en/function.imagewebp.php + * @link https://php.net/manual/en/function.imagewebp.php * @param resource $image * @param string $to [optional]

* The path to save the file to. If not set or &null;, the raw image stream @@ -3671,7 +3900,7 @@ function gd_webp ($image, $to = null, $quality = 80) /** * Output XBM image to browser or file - * @link http://php.net/manual/en/function.imagexbm.php + * @link https://php.net/manual/en/function.imagexbm.php * @param resource $image * @param string $filename

* The path to save the file to. If not set or &null;, the raw image stream @@ -3690,8 +3919,9 @@ function gd_xbm ($image, $filename, $foreground = null) } /** - * Embeds binary IPTC data into a JPEG image - * @link http://php.net/manual/en/function.iptcembed.php + * Embeds binary IPTC data into a JPEG image. + * Note: This function does not require the GD image library. + * @link https://php.net/manual/en/function.iptcembed.php * @param string $iptcdata

* The data to be written. *

@@ -3702,7 +3932,7 @@ function gd_xbm ($image, $filename, $foreground = null) * Spool flag. If the spool flag is over 2 then the JPEG will be * returned as a string. *

- * @return mixed If success and spool flag is lower than 2 then the JPEG will not be + * @return mixed If success and spool flag is lower than 2 then the JPEG will not be * returned as a string, false on errors. * @since 4.0 * @since 5.0 @@ -3714,11 +3944,12 @@ function gd_iptc_embed ($iptcdata, $jpeg_file_name, $spool = null) /** * Parse a binary IPTC block into single tags. - * @link http://php.net/manual/en/function.iptcparse.php + * Note: This function does not require the GD image library. + * @link https://php.net/manual/en/function.iptcparse.php * @param string $iptcblock

* A binary IPTC block. *

- * @return array an array using the tagmarker as an index and the value as the + * @return array|false an array using the tagmarker as an index and the value as the * value. It returns false on error or if no IPTC data was found. * @since 4.0 * @since 5.0 @@ -3730,7 +3961,7 @@ function gd_iptc_parse ($iptcblock) /** * Convert JPEG image file to WBMP image file - * @link http://php.net/manual/en/function.jpeg2wbmp.php + * @link https://php.net/manual/en/function.jpeg2wbmp.php * @param string $jpegname

* Path to JPEG file. *

@@ -3749,6 +3980,7 @@ function gd_iptc_parse ($iptcblock) * @return bool true on success or false on failure. * @since 4.0.5 * @since 5.0 + * @deprecated 7.2.0 Use imagecreatefromjpeg() and imagewbmp() instead */ function gd_jpeg2wbmp ($jpegname, $wbmpname, $dest_height, $dest_width, $threshold) { @@ -3757,7 +3989,7 @@ function gd_jpeg2wbmp ($jpegname, $wbmpname, $dest_height, $dest_width, $thresho /** * Convert PNG image file to WBMP image file - * @link http://php.net/manual/en/function.png2wbmp.php + * @link https://php.net/manual/en/function.png2wbmp.php * @param string $pngname

* Path to PNG file. *

@@ -3776,6 +4008,7 @@ function gd_jpeg2wbmp ($jpegname, $wbmpname, $dest_height, $dest_width, $thresho * @return bool true on success or false on failure. * @since 4.0.5 * @since 5.0 + * @deprecated 7.2.0 Use imagecreatefrompng() and imagewbmp() instead */ function gd_png2wbmp ($pngname, $wbmpname, $dest_height, $dest_width, $threshold) { @@ -3784,9 +4017,9 @@ function gd_png2wbmp ($pngname, $wbmpname, $dest_height, $dest_width, $threshold /** * Determine the type of an image - * @link http://php.net/manual/en/function.exif-imagetype.php + * @link https://php.net/manual/en/function.exif-imagetype.php * @param string $filename The image being checked. - * @return int When a correct signature is found, the appropriate constant value will be + * @return int|false When a correct signature is found, the appropriate constant value will be * returned otherwise the return value is FALSE. The return value is the * same value that getimagesize returns in index 2 but * exif_imagetype is much faster. @@ -3805,11 +4038,11 @@ function exif_image_type ($filename) /** * Get the header name for an index - * @link http://php.net/manual/en/function.exif-tagname.php + * @link https://php.net/manual/en/function.exif-tagname.php * @param int $index

* The Tag ID for which a Tag Name will be looked up. *

- * @return string the header name, or FALSE if index is + * @return string|false the header name, or FALSE if index is * not a defined EXIF tag id. * @since 4.2.0 * @since 5.0 @@ -3819,9 +4052,191 @@ function exif_tag_name ($index) return exif_tagname($index); } +/** + * Check for alphanumeric character(s) + * @link https://php.net/manual/en/function.ctype-alnum.php + * @param string $text

+ * The tested string. + *

+ * @return bool TRUE if every character in text is either + * a letter or a digit, FALSE otherwise. + * @since 4.0.4 + * @since 5.0 + */ +function ctype_is_alnum ($text) +{ + return ctype_alnum($text); +} + +/** + * Check for alphabetic character(s) + * @link https://php.net/manual/en/function.ctype-alpha.php + * @param string $text

+ * The tested string. + *

+ * @return bool TRUE if every character in text is + * a letter from the current locale, FALSE otherwise. + * @since 4.0.4 + * @since 5.0 + */ +function ctype_is_alpha ($text) +{ + return ctype_alpha($text); +} + +/** + * Check for control character(s) + * @link https://php.net/manual/en/function.ctype-cntrl.php + * @param string $text

+ * The tested string. + *

+ * @return bool TRUE if every character in text is + * a control character from the current locale, FALSE otherwise. + * @since 4.0.4 + * @since 5.0 + */ +function ctype_is_cntrl ($text) +{ + return ctype_cntrl($text); +} + +/** + * Check for numeric character(s) + * @link https://php.net/manual/en/function.ctype-digit.php + * @param string $text

+ * The tested string. + *

+ * @return bool TRUE if every character in the string + * text is a decimal digit, FALSE otherwise. + * @since 4.0.4 + * @since 5.0 + */ +function ctype_is_digit ($text) +{ + return ctype_digit($text); +} + +/** + * Check for any printable character(s) except space + * @link https://php.net/manual/en/function.ctype-graph.php + * @param string $text

+ * The tested string. + *

+ * @return bool TRUE if every character in text is + * printable and actually creates visible output (no white space), FALSE + * otherwise. + * @since 4.0.4 + * @since 5.0 + */ +function ctype_is_graph ($text) +{ + return ctype_graph($text); +} + +/** + * Check for lowercase character(s) + * @link https://php.net/manual/en/function.ctype-lower.php + * @param string $text

+ * The tested string. + *

+ * @return bool TRUE if every character in text is + * a lowercase letter in the current locale. + * @since 4.0.4 + * @since 5.0 + */ +function ctype_is_lower ($text) +{ + return ctype_lower($text); +} + +/** + * Check for printable character(s) + * @link https://php.net/manual/en/function.ctype-print.php + * @param string $text

+ * The tested string. + *

+ * @return bool TRUE if every character in text + * will actually create output (including blanks). Returns FALSE if + * text contains control characters or characters + * that do not have any output or control function at all. + * @since 4.0.4 + * @since 5.0 + */ +function ctype_is_print ($text) +{ + return ctype_print($text); +} + +/** + * Check for any printable character which is not whitespace or an + * @since 4.0.4 + * @since 5.0 alphanumeric character + * @link https://php.net/manual/en/function.ctype-punct.php + * @param string $text

+ * The tested string. + *

+ * @return bool TRUE if every character in text + * is printable, but neither letter, digit or blank, FALSE otherwise. + */ +function ctype_is_punct ($text) +{ + return ctype_punct($text); +} + +/** + * Check for whitespace character(s) + * @link https://php.net/manual/en/function.ctype-space.php + * @param string $text

+ * The tested string. + *

+ * @return bool TRUE if every character in text + * creates some sort of white space, FALSE otherwise. Besides the + * blank character this also includes tab, vertical tab, line feed, + * carriage return and form feed characters. + * @since 4.0.4 + * @since 5.0 + */ +function ctype_is_space ($text) +{ + return ctype_space($text); +} + +/** + * Check for uppercase character(s) + * @link https://php.net/manual/en/function.ctype-upper.php + * @param string $text

+ * The tested string. + *

+ * @return bool TRUE if every character in text is + * an uppercase letter in the current locale. + * @since 4.0.4 + * @since 5.0 + */ +function ctype_is_upper ($text) +{ + return ctype_upper($text); +} + +/** + * Check for character(s) representing a hexadecimal digit + * @link https://php.net/manual/en/function.ctype-xdigit.php + * @param string $text

+ * The tested string. + *

+ * @return bool TRUE if every character in text is + * a hexadecimal 'digit', that is a decimal digit or a character from + * [A-Fa-f] , FALSE otherwise. + * @since 4.0.4 + * @since 5.0 + */ +function ctype_is_xdigit ($text) +{ + return ctype_xdigit($text); +} + /** * Decode string in MIME header field - * @link http://php.net/manual/en/function.mb-decode-mimeheader.php + * @link https://php.net/manual/en/function.mb-decode-mimeheader.php * @param string $str

* The string being decoded. *

@@ -3836,7 +4251,7 @@ function mb_decode_mime_header ($str) /** * Decode HTML numeric string reference to character - * @link http://php.net/manual/en/function.mb-decode-numericentity.php + * @link https://php.net/manual/en/function.mb-decode-numericentity.php * @param string $str

* The string being decoded. *

@@ -3856,7 +4271,7 @@ function mb_decode_numeric_entity ($str, array $convmap, $encoding = null) /** * Encode string for MIME header - * @link http://php.net/manual/en/function.mb-encode-mimeheader.php + * @link https://php.net/manual/en/function.mb-encode-mimeheader.php * @param string $str

* The string being encoded. *

@@ -3895,7 +4310,7 @@ function mb_encode_mime_header ($str, $charset = null, $transfer_encoding = null /** * Encode character to HTML numeric string reference - * @link http://php.net/manual/en/function.mb-encode-numericentity.php + * @link https://php.net/manual/en/function.mb-encode-numericentity.php * @param string $str

* The string being encoded. *

@@ -3916,7 +4331,7 @@ function mb_encode_numeric_entity ($str, array $convmap, $encoding = null, $is_h /** * Send encoded mail - * @link http://php.net/manual/en/function.mb-send-mail.php + * @link https://php.net/manual/en/function.mb-send-mail.php * @param string $to

* The mail addresses being sent to. Multiple * recipients may be specified by putting a comma between each @@ -3951,7 +4366,7 @@ function mb_mail ($to, $subject, $message, $additional_headers = null, $addition /** * Queries the remote side of the given socket which may either result in host/port or in a Unix filesystem path, dependent on its type - * @link http://php.net/manual/en/function.socket-getpeername.php + * @link https://php.net/manual/en/function.socket-getpeername.php * @param resource $socket

* A valid socket resource created with socket_create * or socket_accept. @@ -3989,7 +4404,7 @@ function socket_get_peer_name ($socket, &$address, &$port = null) /** * Queries the local side of the given socket which may either result in host/port or in a Unix filesystem path, dependent on its type - * @link http://php.net/manual/en/function.socket-getsockname.php + * @link https://php.net/manual/en/function.socket-getsockname.php * @param resource $socket

* A valid socket resource created with socket_create * or socket_accept. @@ -4025,7 +4440,7 @@ function socket_get_sock_name ($socket, &$addr, &$port = null) /** * Receives data from a socket whether or not it is connection-oriented - * @link http://php.net/manual/en/function.socket-recvfrom.php + * @link https://php.net/manual/en/function.socket-recvfrom.php * @param resource $socket

* The socket must be a socket resource previously * created by socket_create(). @@ -4089,7 +4504,7 @@ function socket_get_sock_name ($socket, &$addr, &$port = null) * from which the data is received. If the socket is connection-oriented, * port will be NULL. *

- * @return int socket_recvfrom returns the number of bytes received, + * @return int|false socket_recvfrom returns the number of bytes received, * or FALSE if there was an error. The actual error code can be retrieved by * calling socket_last_error. This error code may be * passed to socket_strerror to get a textual explanation @@ -4104,11 +4519,11 @@ function socket_recv_from ($socket, &$buf, $len, $flags, &$name, &$port = null) /** * Read a message - * @link http://www.php.net/manual/en/function.socket-recvmsg.php + * @link https://secure.php.net/manual/en/function.socket-recvmsg.php * @param resource $socket * @param string $message * @param int $flags [optional] - * @return int + * @return int|false * @since 5.5.0 */ function socket_recv_msg ($socket , $message, $flags) @@ -4119,11 +4534,11 @@ function socket_recv_msg ($socket , $message, $flags) /** * (PHP 5 >=5.5.0)
* Send a message - * @link http://www.php.net/manual/en/function.socket-sendmsg.php + * @link https://secure.php.net/manual/en/function.socket-sendmsg.php * @param resource $socket * @param array $message * @param int $flags - * @return int + * @return int|false * @since 5.5.0 */ function socket_send_msg ($socket, array $message, $flags ) @@ -4133,7 +4548,7 @@ function socket_send_msg ($socket, array $message, $flags ) /** * Sends a message to a socket, whether it is connected or not - * @link http://php.net/manual/en/function.socket-sendto.php + * @link https://php.net/manual/en/function.socket-sendto.php * @param resource $socket

* A valid socket resource created using socket_create. *

@@ -4185,7 +4600,7 @@ function socket_send_msg ($socket, array $message, $flags ) * port is the remote port number at which the data * will be sent. *

- * @return int socket_sendto returns the number of bytes sent to the + * @return int|false socket_sendto returns the number of bytes sent to the * remote host, or FALSE if an error occurred. * @since 4.1.0 * @since 5.0 @@ -4197,7 +4612,7 @@ function socket_send_to ($socket, $buf, $len, $flags, $addr, $port = 0) /** * Return a string describing a socket error - * @link http://php.net/manual/en/function.socket-strerror.php + * @link https://php.net/manual/en/function.socket-strerror.php * @param int $errno

* A valid socket error number, likely produced by * socket_last_error. @@ -4215,7 +4630,7 @@ function socket_errstr ($errno) /** * Fetches all HTTP headers from the current request. * This function is an alias for apache_request_headers(). Please read the apache_request_headers() documentation for more information on how this function works. - * @link http://php.net/manual/en/function.getallheaders.php + * @link https://php.net/manual/en/function.getallheaders.php * @return array|false An associative array of all the HTTP headers in the current request, or FALSE on failure. * @since 4.0 * @since 5.0 @@ -4230,7 +4645,7 @@ function sapi_request_headers () * virtual() is an Apache-specific function which is similar to in mod_include. It performs an Apache sub-request. It is useful for including CGI scripts or .shtml files, or anything else that you would parse through Apache. Note that for a CGI script, the script must generate valid CGI headers. At the minimum that means it must generate a Content-Type header. * To run the sub-request, all buffers are terminated and flushed to the browser, pending headers are sent too. * This function is supported when PHP is installed as an Apache module or by the NSAPI server module in Netscape/iPlanet/SunONE webservers. - * @link hhttp://php.net/manual/en/function.virtual.php + * @link https://secure.php.net/manual/en/function.virtual.php * @param string $filename

* The file that the virtual command will be performed on. *

@@ -4247,7 +4662,7 @@ function apache_virtual ( $filename ) * Get an Apache subprocess_env variable * Retrieve an Apache environment variable specified by $variable. * This function requires Apache 2 otherwise it's undefined. - * @link http://php.net/manual/en/function.apache-getenv.php + * @link https://php.net/manual/en/function.apache-getenv.php * @param string $variable

* The Apache environment variable. *

@@ -4266,7 +4681,7 @@ function apache_get_env ( $variable, $walk_to_top = false ) /** * Sets the value of the Apache environment variable specified by variable. * Note: When setting an Apache environment variable, the corresponding $_SERVER variable is not changed. - * @link http://php.net/manual/en/function.apache-setenv.php + * @link https://php.net/manual/en/function.apache-setenv.php * @param string $variable

* The environment variable that's being set. *

@@ -4276,18 +4691,292 @@ function apache_get_env ( $variable, $walk_to_top = false ) * @param bool $walk_to_top

* Whether to set the top-level variable available to all Apache layers. *

- * @return bool TRUE on success or FALSE on failure. - * @since 4.2.0 + * @return bool TRUE on success or FALSE on failure. + * @since 4.2.0 + * @since 5.0 + */ +function apache_set_env ( $variable, $value, $walk_to_top = false ) +{ + return apache_setenv($variable, $value, $walk_to_top); +} + +/** + * Format a local time/date + * @link https://php.net/manual/en/function.date.php + * @param string $format

+ * The format of the outputted date string. See the formatting + * options below. There are also several + * predefined date constants + * that may be used instead, so for example DATE_RSS + * contains the format string 'D, d M Y H:i:s'. + *

+ *

+ * The following characters are recognized in the + * format parameter string + * + * + * + * + * + * + * + * Day + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * Week + * + * + * + * + * + * + * + * + * + * Month + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * Year + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * Time + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * Timezone + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * Full Date/Time + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
format characterDescriptionExample returned values
------
dDay of the month, 2 digits with leading zeros01 to 31
DA textual representation of a day, three lettersMon through Sun
jDay of the month without leading zeros1 to 31
l (lowercase 'L')A full textual representation of the day of the weekSunday through Saturday
NISO-8601 numeric representation of the day of the week (added in + * PHP 5.1.0)1 (for Monday) through 7 (for Sunday)
SEnglish ordinal suffix for the day of the month, 2 characters + * st, nd, rd or + * th. Works well with j + *
wNumeric representation of the day of the week0 (for Sunday) through 6 (for Saturday)
zThe day of the year (starting from 0)0 through 365
------
WISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0)Example: 42 (the 42nd week in the year)
------
FA full textual representation of a month, such as January or MarchJanuary through December
mNumeric representation of a month, with leading zeros01 through 12
MA short textual representation of a month, three lettersJan through Dec
nNumeric representation of a month, without leading zeros1 through 12
tNumber of days in the given month28 through 31
------
LWhether it's a leap year1 if it is a leap year, 0 otherwise.
oISO-8601 year number. This has the same value as + * Y, except that if the ISO week number + * (W) belongs to the previous or next year, that year + * is used instead. (added in PHP 5.1.0)Examples: 1999 or 2003
YA full numeric representation of a year, 4 digitsExamples: 1999 or 2003
yA two digit representation of a yearExamples: 99 or 03
------
aLowercase Ante meridiem and Post meridiemam or pm
AUppercase Ante meridiem and Post meridiemAM or PM
BSwatch Internet time000 through 999
g12-hour format of an hour without leading zeros1 through 12
G24-hour format of an hour without leading zeros0 through 23
h12-hour format of an hour with leading zeros01 through 12
H24-hour format of an hour with leading zeros00 through 23
iMinutes with leading zeros00 to 59
sSeconds, with leading zeros00 through 59
uMicroseconds (added in PHP 5.2.2)Example: 654321
------
eTimezone identifier (added in PHP 5.1.0)Examples: UTC, GMT, Atlantic/Azores
I (capital i)Whether or not the date is in daylight saving time1 if Daylight Saving Time, 0 otherwise.
ODifference to Greenwich time (GMT) in hoursExample: +0200
PDifference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3)Example: +02:00
TTimezone abbreviationExamples: EST, MDT ...
ZTimezone offset in seconds. The offset for timezones west of UTC is always + * negative, and for those east of UTC is always positive.-43200 through 50400
------
cISO 8601 date (added in PHP 5)2004-02-12T15:19:21+00:00
rRFC 2822 formatted dateExample: Thu, 21 Dec 2000 16:01:07 +0200
USeconds since the Unix Epoch (January 1 1970 00:00:00 GMT)See also time
+ *

+ *

+ * Unrecognized characters in the format string will be printed + * as-is. The Z format will always return + * 0 when using gmdate. + *

+ *

+ * Since this function only accepts integer timestamps the + * u format character is only useful when using the + * date_format function with user based timestamps + * created with date_create. + *

+ * @param int $timestamp [optional] The optional timestamp parameter is an integer Unix timestamp + * that defaults to the current local time if a timestamp is not given. + * In other words, it defaults to the value of time(). + * @return string|false a formatted date string. If a non-numeric value is used for + * timestamp, false is returned and an + * E_WARNING level error is emitted. + * @since 4.0 * @since 5.0 */ -function apache_set_env ( $variable, $value, $walk_to_top = false ) +function date_format ($format, $timestamp = null) { - return apache_setenv($variable, $value, $walk_to_top); + return date($format, $timestamp); } /** * Get date/time information - * @link http://php.net/manual/en/function.getdate.php + * @link https://php.net/manual/en/function.getdate.php * @param int $timestamp [optional] * @return array an associative array of information related to * the timestamp. Elements from the returned @@ -4373,7 +5062,7 @@ function date_get ($timestamp = null) /** * Validate a Gregorian date - * @link http://php.net/manual/en/function.checkdate.php + * @link https://php.net/manual/en/function.checkdate.php * @param int $month

* The month is between 1 and 12 inclusive. *

@@ -4396,7 +5085,7 @@ function date_check ($month, $day, $year) /** * Format a local time/date as integer - * @link http://php.net/manual/en/function.idate.php + * @link https://php.net/manual/en/function.idate.php * @param string $format

* * The following characters are recognized in the @@ -4495,7 +5184,7 @@ function time_part ($format, $timestamp = null) /** * Get Unix timestamp for a date - * @link http://php.net/manual/en/function.mktime.php + * @link https://php.net/manual/en/function.mktime.php * @param int $hour [optional]

* The number of the hour. *

@@ -4799,7 +5488,7 @@ function time_make ($hour = null, $minute = null, $second = null, $month = null, *

* Contrary to ISO-9899:1999, Sun Solaris starts with Sunday as 1. * As a result, %u may not function as described in this manual. - * @link http://php.net/manual/en/function.strftime.php + * @link https://php.net/manual/en/function.strftime.php * @param string $format

* @param int $timestamp [optional] defaults to the value of time() * Unix timestamp that defaults to the current local time if a timestamp is not given.. @@ -4811,14 +5500,14 @@ function time_make ($hour = null, $minute = null, $second = null, $month = null, * @since 4.0 * @since 5.0 */ -function time_format ($format, $timestamp) +function time_format ($format, $timestamp = null) { return strftime($format, $timestamp); } /** * Format a GMT/UTC date/time - * @link http://php.net/manual/en/function.gmdate.php + * @link https://php.net/manual/en/function.gmdate.php * @param string $format

* The format of the outputted date string. See the formatting * options for the date function. @@ -4837,7 +5526,7 @@ function time_utc ($format, $timestamp = null) /** * Get Unix timestamp for a GMT date - * @link http://php.net/manual/en/function.gmmktime.php + * @link https://php.net/manual/en/function.gmmktime.php * @param int $hour [optional]

* The hour *

@@ -4871,7 +5560,7 @@ function time_utc_make ($hour = null, $minute = null, $second = null, $month = n /** * Format a GMT/UTC time/date according to locale settings - * @link http://php.net/manual/en/function.gmstrftime.php + * @link https://php.net/manual/en/function.gmstrftime.php * @param string $format

* See description in strftime. *

@@ -4891,7 +5580,7 @@ function time_utc_format ($format, $timestamp = null) /** * Get current time - * @link http://php.net/manual/en/function.gettimeofday.php + * @link https://php.net/manual/en/function.gettimeofday.php * @param bool $return_float [optional]

* When set to true, a float instead of an array is returned. *

@@ -4914,7 +5603,7 @@ function time_get ($return_float = null) /** * Get the local time - * @link http://php.net/manual/en/function.localtime.php + * @link https://php.net/manual/en/function.localtime.php * @param int $timestamp [optional] * @param bool $is_associative [optional]

* If set to false or not supplied then the array is returned as a regular, @@ -4937,7 +5626,7 @@ function time_local ($timestamp = null, $is_associative = null) /** * Return current Unix timestamp with microseconds - * @link http://php.net/manual/en/function.microtime.php + * @link https://php.net/manual/en/function.microtime.php * @param bool $get_as_float [optional]

* When called without the optional argument, this function returns the string * "msec sec" where sec is the current time measured in the number of @@ -4960,7 +5649,7 @@ function time_micro ($get_as_float = null) /** * Parse a time/date generated with strftime - * @link http://php.net/manual/en/function.strptime.php + * @link https://php.net/manual/en/function.strptime.php * @param string $date

* The string to parse (e.g. returned from strftime) *

@@ -4972,7 +5661,7 @@ function time_micro ($get_as_float = null) * For more information about the format options, read the * strftime page. *

- * @return array|bool an array or false on failure. + * @return array|false an array or false on failure. *

*

*

@@ -5028,7 +5717,7 @@ function time_parse ($date, $format) /** * Parse about any English textual datetime description into a Unix timestamp - * @link http://php.net/manual/en/function.strtotime.php + * @link https://php.net/manual/en/function.strtotime.php * @param string $time

* The string to parse. Before PHP 5.0.0, microseconds weren't allowed in * the time, since PHP 5.0.0 they are allowed but ignored. @@ -5049,7 +5738,7 @@ function time_from_string ($time, $now = null) /** * Renames a file or directory - * @link http://php.net/manual/en/function.rename.php + * @link https://php.net/manual/en/function.rename.php * @param string $oldname

*

*

@@ -5072,7 +5761,7 @@ function dir_rename ($oldname, $newname, $context = null) /** * Removes directory - * @link http://php.net/manual/en/function.rmdir.php + * @link https://php.net/manual/en/function.rmdir.php * @param string $dirname

* Path to the directory. *

@@ -5088,7 +5777,7 @@ function dir_delete ($dirname, $context = null) /** * Attempts to create the directory specified by pathname. - * @link http://php.net/manual/en/function.mkdir.php + * @link https://php.net/manual/en/function.mkdir.php * @param string $pathname

* The directory path. *

@@ -5119,9 +5808,27 @@ function dir_create ($pathname, $mode = 0777, $recursive = false, $context = nul return mkdir($pathname, $mode, $recursive, $context); } +/** + * Changes file owner + * @link https://php.net/manual/en/function.chown.php + * @param string $filename

+ * Path to the file. + *

+ * @param mixed $user

+ * A user name or number. + *

+ * @return bool true on success or false on failure. + * @since 4.0 + * @since 5.0 + */ +function dir_chown ($filename, $user) +{ + return chown($filename, $user); +} + /** * Changes file mode - * @link http://php.net/manual/en/function.chmod.php + * @link https://php.net/manual/en/function.chmod.php * @param string $filename

* Path to the file. *

@@ -5156,9 +5863,27 @@ function dir_chmod ($filename, $mode) return chmod($filename, $mode); } +/** + * Changes file group + * @link https://php.net/manual/en/function.chgrp.php + * @param string $filename

+ * Path to the file. + *

+ * @param mixed $group

+ * A group name or number. + *

+ * @return bool true on success or false on failure. + * @since 4.0 + * @since 5.0 + */ +function dir_chgrp ($filename, $group) +{ + return chgrp($filename, $group); +} + /** * Returns directory name component of path - * @link http://php.net/manual/en/function.dirname.php + * @link https://php.net/manual/en/function.dirname.php * @param string $path

* A path. *

@@ -5186,7 +5911,7 @@ function dir_name ($path, $levels = 1) /** * Find pathnames matching a pattern - * @link http://php.net/manual/en/function.glob.php + * @link https://php.net/manual/en/function.glob.php * @param string $pattern

* The pattern. No tilde expansion or parameter substitution is done. *

@@ -5199,7 +5924,7 @@ function dir_name ($path, $levels = 1) * GLOB_BRACE - Expands {a,b,c} to match 'a', 'b', or 'c' * GLOB_ONLYDIR - Return only directory entries which match the pattern * GLOB_ERR - Stop on read errors (like unreadable directories), by default errors are ignored. - * @return array an array containing the matched files/directories, an empty array + * @return array|false an array containing the matched files/directories, an empty array * if no file matched or false on error. *

*

@@ -5213,9 +5938,24 @@ function dir_glob ($pattern, $flags = null) return glob($pattern, $flags); } +/** + * Change directory + * @link https://php.net/manual/en/function.chdir.php + * @param string $directory

+ * The new current directory + *

+ * @return bool true on success or false on failure. + * @since 4.0 + * @since 5.0 + */ +function dir_set ($directory) +{ + return chdir($directory); +} + /** * Change the root directory - * @link http://php.net/manual/en/function.chroot.php + * @link https://php.net/manual/en/function.chroot.php * @param string $directory

* The new directory *

@@ -5228,9 +5968,30 @@ function dir_chroot ($directory) return chroot($directory); } +/** + * Gets the current working directory + * @link https://php.net/manual/en/function.getcwd.php + * @return string|false

+ * the current working directory on success, or false on + * failure.
+ *
+ * On some Unix variants, getcwd will return + * false if any one of the parent directories does not have the + * readable or search mode set, even if the current directory + * does. See chmod for more information on + * modes and permissions. + *

+ * @since 4.0 + * @since 5.0 + */ +function dir_get () +{ + return getcwd(); +} + /** * Open directory handle - * @link http://php.net/manual/en/function.opendir.php + * @link https://php.net/manual/en/function.opendir.php * @param string $path

* The directory path that is to be opened *

@@ -5239,7 +6000,7 @@ function dir_chroot ($directory) * refer to the streams section of * the manual. *

- * @return resource|bool a directory handle resource on success, or + * @return resource|false a directory handle resource on success, or * false on failure. *

*

@@ -5261,7 +6022,7 @@ function dir_open ($path, $context = null) /** * Close directory handle - * @link http://php.net/manual/en/function.closedir.php + * @link https://php.net/manual/en/function.closedir.php * @param resource $dir_handle [optional]

* The directory handle resource previously opened * with opendir. If the directory handle is @@ -5277,9 +6038,45 @@ function dir_close ($dir_handle = null) return closedir($dir_handle); } +/** + * Read entry from directory handle + * @link https://php.net/manual/en/function.readdir.php + * @param resource $dir_handle [optional]

+ * The directory handle resource previously opened + * with opendir. If the directory handle is + * not specified, the last link opened by opendir + * is assumed. + *

+ * @return string|false the filename on success or false on failure. + * @since 4.0 + * @since 5.0 + */ +function dir_read ($dir_handle = null) +{ + return readdir($dir_handle); +} + +/** + * Rewind directory handle + * @link https://php.net/manual/en/function.rewinddir.php + * @param resource $dir_handle [optional]

+ * The directory handle resource previously opened + * with opendir. If the directory handle is + * not specified, the last link opened by opendir + * is assumed. + *

+ * @return void + * @since 4.0 + * @since 5.0 + */ +function dir_rewind ($dir_handle = null) +{ + return rewinddir($dir_handle); +} + /** * List files and directories inside the specified path - * @link http://php.net/manual/en/function.scandir.php + * @link https://php.net/manual/en/function.scandir.php * @param string $directory

* The directory that will be scanned. *

@@ -5293,7 +6090,7 @@ function dir_close ($dir_handle = null) * refer to the streams section of * the manual. *

- * @return array an array of filenames on success, or false on + * @return array|false an array of filenames on success, or false on * failure. If directory is not a directory, then * boolean false is returned, and an error of level * E_WARNING is generated. @@ -5306,7 +6103,7 @@ function dir_scan ($directory, $sorting_order = null, $context = null) /** * Returns an array of all defined functions - * @link http://php.net/manual/en/function.get-defined-functions.php + * @link https://php.net/manual/en/function.get-defined-functions.php * @param bool $exclude_disabled [optional] Whether disabled functions should be excluded from the return value. * @return array an multidimensional array containing a list of all defined * functions, both built-in (internal) and user-defined. The internal @@ -5323,7 +6120,7 @@ function function_declared ($exclude_disabled = FALSE) /** * Create an anonymous (lambda-style) function - * @link http://php.net/manual/en/function.create-function.php + * @link https://php.net/manual/en/function.create-function.php * @param string $args

* The function arguments. *

@@ -5342,7 +6139,7 @@ function function_create ($args, $code) /** * Return an item from the argument list - * @link http://php.net/manual/en/function.func-get-arg.php + * @link https://php.net/manual/en/function.func-get-arg.php * @param int $arg_num

* The argument offset. Function arguments are counted starting from * zero. @@ -5358,7 +6155,7 @@ function function_arg ($arg_num) /** * Returns an array comprising a function's argument list - * @link http://php.net/manual/en/function.func-get-args.php + * @link https://php.net/manual/en/function.func-get-args.php * @return array an array in which each element is a copy of the corresponding * member of the current user-defined function's argument list. * @since 4.0 @@ -5371,7 +6168,7 @@ function function_args () /** * Returns the number of arguments passed to the function - * @link http://php.net/manual/en/function.func-num-args.php + * @link https://php.net/manual/en/function.func-num-args.php * @return int the number of arguments passed into the current user-defined * function. * @since 4.0 @@ -5384,7 +6181,7 @@ function function_num_args () /** * Call a user function given by the first parameter - * @link http://php.net/manual/en/function.call-user-func.php + * @link https://php.net/manual/en/function.call-user-func.php * @param callback $function

* The function to be called. Class methods may also be invoked * statically using this function by passing @@ -5399,7 +6196,6 @@ function function_num_args () * Note that the parameters for call_user_func are * not passed by reference. * call_user_func example and references - * ]]> * &example.outputs; *

* @return mixed the function result, or false on error. @@ -5413,7 +6209,7 @@ function function_call_user ($function, ...$parameter) /** * Call a user function given with an array of parameters - * @link http://php.net/manual/en/function.call-user-func-array.php + * @link https://php.net/manual/en/function.call-user-func-array.php * @param callback $function

* The function to be called. *

@@ -5431,7 +6227,7 @@ function function_call_user_array ($function, array $param_arr) /** * Register a function for execution on shutdown - * @link http://php.net/manual/en/function.register-shutdown-function.php + * @link https://php.net/manual/en/function.register-shutdown-function.php * @param callback $function

* The shutdown function to register. *

@@ -5462,7 +6258,7 @@ function function_shutdown_register ($function, $parameter = null, ...$_) /** * Register a function for execution on each tick - * @link http://php.net/manual/en/function.register-tick-function.php + * @link https://php.net/manual/en/function.register-tick-function.php * @param callback $function

* The function name as a string, or an array consisting of an object and * a method. @@ -5481,7 +6277,7 @@ function function_tick_register ($function, $arg = null, ...$_) /** * De-register a function for execution on each tick - * @link http://php.net/manual/en/function.unregister-tick-function.php + * @link https://php.net/manual/en/function.unregister-tick-function.php * @param callable $function

* The function name as a string, or an array consisting of an object and * a method. @@ -5497,7 +6293,7 @@ function function_tick_unregister ($function) /** * Call a static method and pass the arguments as array - * @link http://php.net/manual/en/function.forward-static-call-array.php + * @link https://php.net/manual/en/function.forward-static-call-array.php * @param callback $function

* The function or method to be called. This parameter may be an &array;, * with the name of the class, and the method, or a &string;, with a function @@ -5514,7 +6310,7 @@ function function_static_call_array ($function, array $parameters = null) /** * Call a static method - * @link http://php.net/manual/en/function.forward-static-call.php + * @link https://php.net/manual/en/function.forward-static-call.php * @param callback $function

* The function or method to be called. This parameter may be an array, * with the name of the class, and the method, or a string, with a function @@ -5534,7 +6330,7 @@ function function_static_call ($function, $parameter = null, ...$_) /** * Execute an external program and display raw output - * @link http://php.net/manual/en/function.passthru.php + * @link https://php.net/manual/en/function.passthru.php * @param string $command

* The command that will be executed. *

@@ -5553,11 +6349,11 @@ function exec_passthru ($command, &$return_var = null) /** * Execute command via shell and return the complete output as a string - * @link http://php.net/manual/en/function.shell-exec.php + * @link https://php.net/manual/en/function.shell-exec.php * @param string $cmd

* The command that will be executed. *

- * @return string The output from the executed command. + * @return string|null The output from the executed command or NULL if an error occurred or the command produces no output. * @since 4.0 * @since 5.0 */ @@ -5568,7 +6364,7 @@ function exec_shell ($cmd) /** * Execute an external program and display the output - * @link http://php.net/manual/en/function.system.php + * @link https://php.net/manual/en/function.system.php * @param string $command

* The command that will be executed. *

@@ -5577,7 +6373,7 @@ function exec_shell ($cmd) * return status of the executed command will be written to this * variable. *

- * @return string|bool the last line of the command output on success, and false + * @return string|false the last line of the command output on success, and false * on failure. * @since 4.0 * @since 5.0 @@ -5589,7 +6385,7 @@ function exec_system ($command, &$return_var = null) /** * Escape a string to be used as a shell argument - * @link http://php.net/manual/en/function.escapeshellarg.php + * @link https://php.net/manual/en/function.escapeshellarg.php * @param string $arg

* The argument that will be escaped. *

@@ -5604,7 +6400,7 @@ function exec_escape_arg ($arg) /** * Escape shell metacharacters - * @link http://php.net/manual/en/function.escapeshellcmd.php + * @link https://php.net/manual/en/function.escapeshellcmd.php * @param string $command

* The command that will be escaped. *

@@ -5619,7 +6415,7 @@ function exec_escape_cmd ($command) /** * Convert all applicable characters to HTML entities - * @link http://php.net/manual/en/function.htmlentities.php + * @link https://php.net/manual/en/function.htmlentities.php * @param string $string

* The input string. *

@@ -5670,9 +6466,9 @@ function html_entities ($string, $quote_style = null, $charset = null, $double_e /** * Convert special characters to HTML entities - * @link http://php.net/manual/en/function.htmlspecialchars.php + * @link https://php.net/manual/en/function.htmlspecialchars.php * @param string $string

- * The {@link http://www.php.net/manual/en/language.types.string.php string} being converted. + * The {@link https://secure.php.net/manual/en/language.types.string.php string} being converted. *

* @param int $flags [optional]

* A bitmask of one or more of the following flags, which specify how to handle quotes, @@ -5709,7 +6505,7 @@ function html_entities ($string, $quote_style = null, $charset = null, $double_e *

* * @@ -5793,7 +6589,7 @@ function html_escape ($string, $flags = ENT_COMPAT | ENT_HTML401, $encoding = 'U /** * Convert special HTML entities back to characters - * @link http://php.net/manual/en/function.htmlspecialchars-decode.php + * @link https://php.net/manual/en/function.htmlspecialchars-decode.php * @param string $string

* The string to decode *

@@ -5830,7 +6626,7 @@ function html_escape_decode ($string, $quote_style = null) /** * Inserts HTML line breaks before all newlines in a string - * @link http://php.net/manual/en/function.nl2br.php + * @link https://php.net/manual/en/function.nl2br.php * @param string $string

* The input string. *

@@ -5841,14 +6637,14 @@ function html_escape_decode ($string, $quote_style = null) * @since 4.0 * @since 5.0 */ -function html_nl2br ($string, $is_xhtml = null) +function html_nl2br ($string, $is_xhtml = true) { return nl2br($string, $is_xhtml); } /** * Strip HTML and PHP tags from a string - * @link http://php.net/manual/en/function.strip-tags.php + * @link https://php.net/manual/en/function.strip-tags.php * @param string $str

* The input string. *

@@ -5871,7 +6667,7 @@ function html_strip_tags ($str, $allowable_tags = null) /** * Returns the translation table used by htmlspecialchars and htmlentities - * @link http://php.net/manual/en/function.get-html-translation-table.php + * @link https://php.net/manual/en/function.get-html-translation-table.php * @param int $table [optional]

* There are two new constants (HTML_ENTITIES, * HTML_SPECIALCHARS) that allow you to specify the @@ -6026,9 +6822,9 @@ function html_strip_tags ($str, $allowable_tags = null) *

* * * @@ -6053,7 +6849,7 @@ function html_translation_table ($table = null, $quote_style = null, string $enc /** * Get numeric formatting information - * @link http://php.net/manual/en/function.localeconv.php + * @link https://php.net/manual/en/function.localeconv.php * @return array localeconv returns data based upon the current locale * as set by setlocale. The associative array that is * returned contains the following fields: @@ -6178,7 +6974,7 @@ function locale_conv () /** * Set locale information - * @link http://php.net/manual/en/function.setlocale.php + * @link https://php.net/manual/en/function.setlocale.php * @param int $category

*

* category is a named constant specifying the @@ -6231,7 +7027,7 @@ function locale_conv () * for a possibly not available locale. *

* @param string $_ [optional] - * @return string the new current locale, or false if the locale functionality is + * @return string|false the new current locale, or false if the locale functionality is * not implemented on your platform, the specified locale does not exist or * the category name is invalid. *

@@ -6255,7 +7051,7 @@ function locale_set ($category, $locale, ...$_) /** * Query language and locale information - * @link http://php.net/manual/en/function.nl-langinfo.php + * @link https://php.net/manual/en/function.nl-langinfo.php * @param int $item

* item may be an integer value of the element or the * constant name of the element. The following is a list of constant names @@ -6393,7 +7189,7 @@ function locale_set ($category, $locale, ...$_) *

* * Returns 0 if parentheses surround the quantity and CURRENCY_SYMBOL. - * @return string the element as a string, or false if item + * @return string|false the element as a string, or false if item * is not valid. * @since 4.1.0 * @since 5.0 @@ -6405,7 +7201,7 @@ function locale_info ($item) /** * Quote string with slashes in a C style - * @link http://php.net/manual/en/function.addcslashes.php + * @link https://php.net/manual/en/function.addcslashes.php * @param string $str

* The string to be escaped. *

@@ -6448,7 +7244,7 @@ function str_cslashes ($str, $charlist) /** * Un-quote string quoted with addcslashes - * @link http://php.net/manual/en/function.stripcslashes.php + * @link https://php.net/manual/en/function.stripcslashes.php * @param string $str

* The string to be unescaped. *

@@ -6463,7 +7259,7 @@ function str_cslashes_strip ($str) /** * Quote string with slashes - * @link http://php.net/manual/en/function.addslashes.php + * @link https://php.net/manual/en/function.addslashes.php * @param string $str

* The string to be escaped. *

@@ -6478,7 +7274,7 @@ function str_slashes ($str) /** * Un-quotes a quoted string - * @link http://php.net/manual/en/function.stripslashes.php + * @link https://php.net/manual/en/function.stripslashes.php * @param string $str

* The input string. *

@@ -6497,21 +7293,21 @@ function str_slashes_strip ($str) /** * &Alias; rtrim * @see rtrim() - * @link http://php.net/manual/en/function.chop.php + * @link https://php.net/manual/en/function.chop.php * @param string $str The input string. * @param string $character_mask [optional] * @return string the modified string. * @since 4.0 * @since 5.0 */ -function str_chop ($str, $character_mask) +function str_chop ($str, $character_mask = null) { return chop($str, $character_mask); } /** * Return information about characters used in a string - * @link http://php.net/manual/en/function.count-chars.php + * @link https://php.net/manual/en/function.count-chars.php * @param string $string

* The examined string. *

@@ -6538,7 +7334,7 @@ function str_count_chars ($string, $mode = null) /** * Split a string into smaller chunks - * @link http://php.net/manual/en/function.chunk-split.php + * @link https://php.net/manual/en/function.chunk-split.php * @param string $body

* The string to be chunked. *

@@ -6559,7 +7355,7 @@ function str_chunk_split ($body, $chunklen = null, $end = null) /** * Split a string by string - * @link http://php.net/manual/en/function.explode.php + * @link https://php.net/manual/en/function.explode.php * @param string $delimiter

* The boundary string. *

@@ -6595,7 +7391,7 @@ function str_explode ($delimiter, $string, $limit = null) /** * Join array elements with a string - * @link http://php.net/manual/en/function.implode.php + * @link https://php.net/manual/en/function.implode.php * @param string $glue [optional]

* Defaults to an empty string. This is not the preferred usage of * implode as glue would be @@ -6616,7 +7412,7 @@ function str_implode ($glue = "", array $pieces) /** * Formats a number as a currency string - * @link http://php.net/manual/en/function.money-format.php + * @link https://php.net/manual/en/function.money-format.php * @param string $format

* The format specification consists of the following sequence: *

a % character

@@ -6637,7 +7433,7 @@ function str_money_format ($format, $number) /** * Format a number with grouped thousands - * @link http://php.net/manual/en/function.number-format.php + * @link https://php.net/manual/en/function.number-format.php * @param float $number

* The number being formatted. *

@@ -6657,7 +7453,7 @@ function str_number_format ($number , $decimals = 0 , $dec_point = '.' , $thousa /** * Calculate Levenshtein distance between two strings - * @link http://php.net/manual/en/function.levenshtein.php + * @link https://php.net/manual/en/function.levenshtein.php * Note: In its simplest form the function will take only the two strings * as parameter and will calculate just the number of insert, replace and * delete operations needed to transform str1 into str2. @@ -6692,7 +7488,7 @@ function str_levenshtein ($str1, $str2, $cost_ins = null, $cost_rep = null, $cos /** * Calculate the metaphone key of a string - * @link http://php.net/manual/en/function.metaphone.php + * @link https://php.net/manual/en/function.metaphone.php * @param string $str

* The input string. *

@@ -6700,7 +7496,7 @@ function str_levenshtein ($str1, $str2, $cost_ins = null, $cost_rep = null, $cos * This parameter restricts the returned metaphone key to phonemes characters in length. * The default value of 0 means no restriction. *

- * @return string|bool the metaphone key as a string, or FALSE on failure + * @return string|false the metaphone key as a string, or FALSE on failure * @since 4.0 * @since 5.0 */ @@ -6711,7 +7507,7 @@ function str_metaphone ($str, $phonemes = 0) /** * Parses the string into variables - * @link http://php.net/manual/en/function.parse-str.php + * @link https://php.net/manual/en/function.parse-str.php * @param string $str

* The input string. *

@@ -6730,7 +7526,7 @@ function str_parse ($str, array &$arr = null) /** * Quote meta characters - * @link http://php.net/manual/en/function.quotemeta.php + * @link https://php.net/manual/en/function.quotemeta.php * @param string $str

* The input string. *

@@ -6745,7 +7541,7 @@ function str_quote_meta ($str) /** * Calculate the similarity between two strings - * @link http://php.net/manual/en/function.similar-text.php + * @link https://php.net/manual/en/function.similar-text.php * @param string $first

* The first string. *

@@ -6768,7 +7564,7 @@ function str_similar_text ($first, $second, &$percent = null) /** * Calculate the soundex key of a string - * @link http://php.net/manual/en/function.soundex.php + * @link https://php.net/manual/en/function.soundex.php * @param string $str

* The input string. *

@@ -6783,7 +7579,7 @@ function str_soundex ($str) /** * Parses input from a string according to a format - * @link http://php.net/manual/en/function.sscanf.php + * @link https://php.net/manual/en/function.sscanf.php * @param string $str

* The input string being parsed. *

@@ -6798,7 +7594,7 @@ function str_soundex ($str) * i stands for integer with base detection. * n stands for number of characters processed so far. *

- * @param mixed $_ [optional] + * @param mixed ...$_ * @return mixed If only * two parameters were passed to this function, the values parsed * will be returned as an array. Otherwise, if optional parameters are passed, @@ -6823,7 +7619,7 @@ function str_sscanf ($str, $format, &...$_) *
  • "\0" (ASCII 0 (0x00)), the NUL-byte. *
  • "\x0B" (ASCII 11 (0x0B)), a vertical tab. * - * @link http://php.net/manual/en/function.rtrim.php + * @link https://php.net/manual/en/function.rtrim.php * @param string $str

    * The input string. *

    @@ -6844,7 +7640,7 @@ function str_rtrim ($str, $charlist = " \t\n\r\0\x0B") /** * Strip whitespace (or other characters) from the beginning and end of a string - * @link http://php.net/manual/en/function.trim.php + * @link https://php.net/manual/en/function.trim.php * @param string $str

    * The string that will be trimmed. *

    @@ -6865,7 +7661,7 @@ function str_trim ($str, $charlist = " \t\n\r\0\x0B") /** * Strip whitespace (or other characters) from the beginning of a string - * @link http://php.net/manual/en/function.ltrim.php + * @link https://php.net/manual/en/function.ltrim.php * @param string $str

    * The input string. *

    @@ -6901,7 +7697,7 @@ function str_ltrim ($str, $charlist = " \t\n\r\0\x0B") /** * Make a string's first character lowercase - * @link http://php.net/manual/en/function.lcfirst.php + * @link https://php.net/manual/en/function.lcfirst.php * @param string $str

    * The input string. *

    @@ -6915,7 +7711,7 @@ function str_lc_first ($str) /** * Make a string's first character uppercase - * @link http://php.net/manual/en/function.ucfirst.php + * @link https://php.net/manual/en/function.ucfirst.php * @param string $str

    * The input string. *

    @@ -6930,7 +7726,7 @@ function str_uc_first ($str) /** * Uppercase the first character of each word in a string - * @link http://php.net/manual/en/function.ucwords.php + * @link https://php.net/manual/en/function.ucwords.php * @param string $str

    * The input string. *

    @@ -6946,7 +7742,7 @@ function str_uc_words ($str, $delimiters = " \t\r\n\f\v") /** * Wraps a string to a given number of characters - * @link http://php.net/manual/en/function.wordwrap.php + * @link https://php.net/manual/en/function.wordwrap.php * @param string $str

    * The input string. *

    @@ -6974,7 +7770,7 @@ function str_word_wrap ($str, $width = 75, $break = "\n", $cut = false) /** * Binary safe string comparison - * @link http://php.net/manual/en/function.strcmp.php + * @link https://php.net/manual/en/function.strcmp.php * @param string $str1

    * The first string. *

    @@ -6995,7 +7791,7 @@ function str_cmp ($str1, $str2) /** * Binary safe string comparison of the first n characters - * @link http://php.net/manual/en/function.strncmp.php + * @link https://php.net/manual/en/function.strncmp.php * @param string $str1

    * The first string. *

    @@ -7019,7 +7815,7 @@ function str_ncmp ($str1, $str2, $len) /** * Binary safe case-insensitive string comparison - * @link http://php.net/manual/en/function.strcasecmp.php + * @link https://php.net/manual/en/function.strcasecmp.php * @param string $str1

    * The first string *

    @@ -7040,7 +7836,7 @@ function str_case_cmp ($str1, $str2) /** * Binary safe case-insensitive string comparison of the first n characters - * @link http://php.net/manual/en/function.strncasecmp.php + * @link https://php.net/manual/en/function.strncasecmp.php * @param string $str1

    * The first string. *

    @@ -7063,7 +7859,7 @@ function str_ncase_cmp ($str1, $str2, $len) /** * String comparisons using a "natural order" algorithm - * @link http://php.net/manual/en/function.strnatcmp.php + * @link https://php.net/manual/en/function.strnatcmp.php * @param string $str1

    * The first string. *

    @@ -7084,7 +7880,7 @@ function str_nat_cmp ($str1, $str2) /** * Case insensitive string comparisons using a "natural order" algorithm - * @link http://php.net/manual/en/function.strnatcasecmp.php + * @link https://php.net/manual/en/function.strnatcasecmp.php * @param string $str1

    * The first string. *

    @@ -7105,7 +7901,7 @@ function str_nat_case_cmp ($str1, $str2) /** * Make a string lowercase - * @link http://php.net/manual/en/function.strtolower.php + * @link https://php.net/manual/en/function.strtolower.php * @param string $str

    * The input string. *

    @@ -7120,7 +7916,7 @@ function str_to_lower ($str) /** * Make a string uppercase - * @link http://php.net/manual/en/function.strtoupper.php + * @link https://php.net/manual/en/function.strtoupper.php * @param string $string

    * The input string. *

    @@ -7135,7 +7931,7 @@ function str_to_upper ($string) /** * Parse a CSV string into an array - * @link http://php.net/manual/en/function.str-getcsv.php + * @link https://php.net/manual/en/function.str-getcsv.php * @param string $input

    * The string to parse. *

    @@ -7159,7 +7955,7 @@ function str_get_csv ($input, $delimiter = ",", $enclosure = '"', $escape = "\\" /** * &Alias; strstr - * @link http://php.net/manual/en/function.strchr.php + * @link https://php.net/manual/en/function.strchr.php * Note: This function is case-sensitive. For case-insensitive searches, use stristr(). * Note: If you only want to determine if a particular needle occurs within haystack, * use the faster and less memory intensive function strpos() instead. @@ -7169,16 +7965,16 @@ function str_get_csv ($input, $delimiter = ",", $enclosure = '"', $escape = "\\" * @param string $haystack The input string. * @param mixed $needle If needle is not a string, it is converted to an integer and applied as the ordinal value of a character. * @param bool $part [optional] If TRUE, strstr() returns the part of the haystack before the first occurrence of the needle (excluding the needle). - * @return string Returns the portion of string, or FALSE if needle is not found. + * @return string|false Returns the portion of string, or FALSE if needle is not found. */ -function str_chr ($haystack, $needle, $part) +function str_chr ($haystack, $needle, $part = false) { return strchr($haystack, $needle, $part); } /** * Locale based string comparison - * @link http://php.net/manual/en/function.strcoll.php + * @link https://php.net/manual/en/function.strcoll.php * @param string $str1

    * The first string. *

    @@ -7199,7 +7995,7 @@ function str_coll ($str1, $str2) /** * Find length of initial segment not matching mask - * @link http://php.net/manual/en/function.strcspn.php + * @link https://php.net/manual/en/function.strcspn.php * @param string $str1

    * The first string. *

    @@ -7223,7 +8019,7 @@ function str_cspn ($str1, $str2, $start = null, $length = null) /** * Find position of first occurrence of a case-insensitive string - * @link http://php.net/manual/en/function.stripos.php + * @link https://php.net/manual/en/function.stripos.php * @param string $haystack

    * The string to search in *

    @@ -7241,7 +8037,7 @@ function str_cspn ($str1, $str2, $start = null, $length = null) * start searching. The position returned is still relative to the * beginning of haystack. *

    - * @return int If needle is not found, + * @return int|false If needle is not found, * stripos will return boolean false. * @since 5.0 */ @@ -7252,7 +8048,7 @@ function str_ipos ($haystack, $needle, $offset = null) /** * Case-insensitive strstr - * @link http://php.net/manual/en/function.stristr.php + * @link https://php.net/manual/en/function.stristr.php * @param string $haystack

    * The string to search in *

    @@ -7265,7 +8061,7 @@ function str_ipos ($haystack, $needle, $offset = null) * returns the part of the haystack before the * first occurrence of the needle. *

    - * @return string the matched substring. If needle is not + * @return string|false the matched substring. If needle is not * found, returns false. * @since 4.0 * @since 5.0 @@ -7277,7 +8073,7 @@ function str_istr ($haystack, $needle, $before_needle = null) /** * Get string length - * @link http://php.net/manual/en/function.strlen.php + * @link https://php.net/manual/en/function.strlen.php * @param string $string

    * The string being measured for length. *

    @@ -7293,14 +8089,14 @@ function str_len ($string) /** * Search a string for any of a set of characters - * @link http://php.net/manual/en/function.strpbrk.php + * @link https://php.net/manual/en/function.strpbrk.php * @param string $haystack

    * The string where char_list is looked for. *

    * @param string $char_list

    * This parameter is case sensitive. *

    - * @return string a string starting from the character found, or false if it is + * @return string|false a string starting from the character found, or false if it is * not found. * @since 5.0 */ @@ -7311,7 +8107,7 @@ function str_pbrk ($haystack, $char_list) /** * Find the position of the first occurrence of a substring in a string - * @link http://php.net/manual/en/function.strpos.php + * @link https://php.net/manual/en/function.strpos.php * @param string $haystack

    * The string to search in *

    @@ -7323,7 +8119,7 @@ function str_pbrk ($haystack, $char_list) * If specified, search will start this number of characters counted from * the beginning of the string. Unlike {@see strrpos()} and {@see strripos()}, the offset cannot be negative. *

    - * @return int|boolean

    + * @return int|false

    * Returns the position where the needle exists relative to the beginnning of * the haystack string (independent of search direction * or offset). @@ -7342,7 +8138,7 @@ function str_pos ($haystack, $needle, $offset = 0) /** * Find the last occurrence of a character in a string - * @link http://php.net/manual/en/function.strrchr.php + * @link https://php.net/manual/en/function.strrchr.php * @param string $haystack

    * The string to search in *

    @@ -7354,7 +8150,7 @@ function str_pos ($haystack, $needle, $offset = 0) * If needle is not a string, it is converted to * an integer and applied as the ordinal value of a character. *

    - * @return string

    + * @return string|false

    * This function returns the portion of string, or FALSE if * needle is not found. *

    @@ -7368,7 +8164,7 @@ function str_rchr ($haystack, $needle) /** * Reverse a string - * @link http://php.net/manual/en/function.strrev.php + * @link https://php.net/manual/en/function.strrev.php * @param string $string

    * The string to be reversed. *

    @@ -7383,7 +8179,7 @@ function str_rev ($string) /** * Find position of last occurrence of a case-insensitive string in a string - * @link http://php.net/manual/en/function.strripos.php + * @link https://php.net/manual/en/function.strripos.php * @param string $haystack

    * The string to search in *

    @@ -7400,7 +8196,7 @@ function str_rev ($string) * offset characters from the * start of the string. *

    - * @return int the numerical position of the last occurrence of + * @return int|false the numerical position of the last occurrence of * needle. Also note that string positions start at 0, * and not 1. *

    @@ -7415,7 +8211,7 @@ function str_ripos ($haystack, $needle, $offset = null) /** * Find the position of the last occurrence of a substring in a string - * @link http://php.net/manual/en/function.strrpos.php + * @link https://php.net/manual/en/function.strrpos.php * @param string $haystack

    * The string to search in. *

    @@ -7425,7 +8221,7 @@ function str_ripos ($haystack, $needle, $offset = null) * @param int $offset [optional]

    * If specified, search will start this number of characters counted from the beginning of the string. If the value is negative, search will instead start from that many characters from the end of the string, searching backwards. *

    - * @return int|boolean

    + * @return int|false

    * Returns the position where the needle exists relative to the beginning of * the haystack string (independent of search direction * or offset). @@ -7442,9 +8238,66 @@ function str_rpos ($haystack, $needle, $offset = 0) return strrpos($haystack, $needle, $offset); } +/** + * Finds the length of the first segment of a string consisting + * entirely of characters contained within a given mask. + * @link https://php.net/manual/en/function.strspn.php + * @param string $subject

    + * The string to examine. + *

    + * @param string $mask

    + * The list of allowable characters to include in counted segments. + *

    + * @param int $start [optional]

    + * The position in subject to + * start searching. + *

    + *

    + * If start is given and is non-negative, + * then strspn will begin + * examining subject at + * the start'th position. For instance, in + * the string 'abcdef', the character at + * position 0 is 'a', the + * character at position 2 is + * 'c', and so forth. + *

    + *

    + * If start is given and is negative, + * then strspn will begin + * examining subject at + * the start'th position from the end + * of subject. + *

    + * @param int $length [optional]

    + * The length of the segment from subject + * to examine. + *

    + *

    + * If length is given and is non-negative, + * then subject will be examined + * for length characters after the starting + * position. + *

    + *

    + * If lengthis given and is negative, + * then subject will be examined from the + * starting position up to length + * characters from the end of subject. + *

    + * @return int the length of the initial segment of str1 + * which consists entirely of characters in str2. + * @since 4.0 + * @since 5.0 + */ +function str_spn ($subject, $mask, $start = null, $length = null) +{ + return strspn($subject, $mask, $start, $length); +} + /** * Find first occurrence of a string - * @link http://php.net/manual/en/function.strstr.php + * @link https://php.net/manual/en/function.strstr.php * @param string $haystack

    * The input string. *

    @@ -7457,7 +8310,7 @@ function str_rpos ($haystack, $needle, $offset = 0) * the part of the haystack before the first * occurrence of the needle. *

    - * @return string the portion of string, or false if needle + * @return string|false the portion of string, or false if needle * is not found. * @since 4.0 * @since 5.0 @@ -7474,7 +8327,7 @@ function str_str ($haystack, $needle, $before_needle = null) * To start over, or to tokenize a new string you simply call strtok with the string argument again to initialize it. * Note that you may put multiple tokens in the token parameter. * The string will be tokenized when any one of the characters in the argument are found. - * @link http://php.net/manual/en/function.strtok.php + * @link https://php.net/manual/en/function.strtok.php * @param string $str [optional]

    * The string being split up into smaller strings (tokens). *

    @@ -7502,7 +8355,7 @@ function str_tr ($str, array $replace_pairs) /** * Get part of string - * @link http://php.net/manual/en/function.mb-strcut.php + * @link https://php.net/manual/en/function.mb-strcut.php * @param string $str

    * The string being cut. *

    @@ -7527,7 +8380,7 @@ function mb_str_cut ($str, $start, $length = null, $encoding = null) /** * Get truncated string with specified width - * @link http://php.net/manual/en/function.mb-strimwidth.php + * @link https://php.net/manual/en/function.mb-strimwidth.php * @param string $str

    * The string being decoded. *

    @@ -7555,7 +8408,7 @@ function mb_str_trim_width ($str, $start, $width, $trimmarker = null, $encoding /** * Finds position of first occurrence of a string within another, case insensitive - * @link http://php.net/manual/en/function.mb-stripos.php + * @link https://php.net/manual/en/function.mb-stripos.php * @param string $haystack

    * The string from which to get the position of the first occurrence * of needle @@ -7583,7 +8436,7 @@ function mb_str_ipos ($haystack, $needle, $offset = 0, $encoding = null) /** * Finds first occurrence of a string within another, case insensitive - * @link http://php.net/manual/en/function.mb-stristr.php + * @link https://php.net/manual/en/function.mb-stristr.php * @param string $haystack

    * The string from which to get the first occurrence * of needle @@ -7591,9 +8444,9 @@ function mb_str_ipos ($haystack, $needle, $offset = 0, $encoding = null) * @param string $needle

    * The string to find in haystack *

    - * @param bool $part [optional]

    + * @param bool $before_needle [optional]

    * Determines which portion of haystack - * this function returns. + * this function returns. * If set to true, it returns all of haystack * from the beginning to the first occurrence of needle. * If set to false, it returns all of haystack @@ -7607,14 +8460,14 @@ function mb_str_ipos ($haystack, $needle, $offset = 0, $encoding = null) * or false if needle is not found. * @since 5.2.0 */ -function mb_str_istr ($haystack, $needle, $part = null, $encoding = null) +function mb_str_istr ($haystack, $needle, $before_needle = false, $encoding = null) { - return mb_stristr($haystack, $needle, $part, $encoding); + return mb_stristr($haystack, $needle, $before_needle, $encoding); } /** * Get string length - * @link http://php.net/manual/en/function.mb-strlen.php + * @link https://php.net/manual/en/function.mb-strlen.php * @param string $str

    * The string being checked for length. *

    @@ -7633,7 +8486,7 @@ function mb_str_len ($str, $encoding = null) /** * Find position of first occurrence of string in a string - * @link http://php.net/manual/en/function.mb-strpos.php + * @link https://php.net/manual/en/function.mb-strpos.php * @param string $haystack

    * The string being checked. *

    @@ -7658,7 +8511,7 @@ function mb_str_pos ($haystack, $needle, $offset = 0, $encoding = null) /** * Finds the last occurrence of a character in a string within another - * @link http://php.net/manual/en/function.mb-strrchr.php + * @link https://php.net/manual/en/function.mb-strrchr.php * @param string $haystack

    * The string from which to get the last occurrence * of needle @@ -7666,7 +8519,7 @@ function mb_str_pos ($haystack, $needle, $offset = 0, $encoding = null) * @param string $needle

    * The string to find in haystack *

    - * @param bool $part [optional]

    + * @param bool $before_needle [optional]

    * Determines which portion of haystack * this function returns. * If set to true, it returns all of haystack @@ -7682,14 +8535,14 @@ function mb_str_pos ($haystack, $needle, $offset = 0, $encoding = null) * or false if needle is not found. * @since 5.2.0 */ -function mb_str_rchr ($haystack, $needle, $part = null, $encoding = null) +function mb_str_rchr ($haystack, $needle, $before_needle = false, $encoding = null) { - return mb_strrchr($haystack, $needle, $part, $encoding); + return mb_strrchr($haystack, $needle, $before_needle, $encoding); } /** * Finds the last occurrence of a character in a string within another, case insensitive - * @link http://php.net/manual/en/function.mb-strrichr.php + * @link https://php.net/manual/en/function.mb-strrichr.php * @param string $haystack

    * The string from which to get the last occurrence * of needle @@ -7697,7 +8550,7 @@ function mb_str_rchr ($haystack, $needle, $part = null, $encoding = null) * @param string $needle

    * The string to find in haystack *

    - * @param bool $part [optional]

    + * @param bool $before_needle [optional]

    * Determines which portion of haystack * this function returns. * If set to true, it returns all of haystack @@ -7713,14 +8566,14 @@ function mb_str_rchr ($haystack, $needle, $part = null, $encoding = null) * or false if needle is not found. * @since 5.2.0 */ -function mb_str_richr ($haystack, $needle, $part = null, $encoding = null) +function mb_str_richr ($haystack, $needle, $before_needle = false, $encoding = null) { - return mb_strrichr($haystack, $needle, $part, $encoding); + return mb_strrichr($haystack, $needle, $before_needle, $encoding); } /** * Finds position of last occurrence of a string within another, case insensitive - * @link http://php.net/manual/en/function.mb-strripos.php + * @link https://php.net/manual/en/function.mb-strripos.php * @param string $haystack

    * The string from which to get the position of the last occurrence * of needle @@ -7749,7 +8602,7 @@ function mb_str_ripos ($haystack, $needle, $offset = 0, $encoding = null) /** * Find position of last occurrence of a string in a string - * @link http://php.net/manual/en/function.mb-strrpos.php + * @link https://php.net/manual/en/function.mb-strrpos.php * @param string $haystack

    * The string being checked, for the last occurrence * of needle @@ -7775,7 +8628,7 @@ function mb_str_rpos ($haystack, $needle, $offset = 0, $encoding = null) /** * Finds first occurrence of a string within another - * @link http://php.net/manual/en/function.mb-strstr.php + * @link https://php.net/manual/en/function.mb-strstr.php * @param string $haystack

    * The string from which to get the first occurrence * of needle @@ -7783,7 +8636,7 @@ function mb_str_rpos ($haystack, $needle, $offset = 0, $encoding = null) * @param string $needle

    * The string to find in haystack *

    - * @param bool $part [optional]

    + * @param bool $before_needle [optional]

    * Determines which portion of haystack * this function returns. * If set to true, it returns all of haystack @@ -7799,14 +8652,14 @@ function mb_str_rpos ($haystack, $needle, $offset = 0, $encoding = null) * or false if needle is not found. * @since 5.2.0 */ -function mb_str_str ($haystack, $needle, $part = null, $encoding = null) +function mb_str_str ($haystack, $needle, $before_needle = false, $encoding = null) { - return mb_strstr($haystack, $needle, $part, $encoding); + return mb_strstr($haystack, $needle, $before_needle, $encoding); } /** * Make a string lowercase - * @link http://php.net/manual/en/function.mb-strtolower.php + * @link https://php.net/manual/en/function.mb-strtolower.php * @param string $str

    * The string being lowercased. *

    @@ -7822,7 +8675,7 @@ function mb_str_to_lower ($str, $encoding = null) /** * Make a string uppercase - * @link http://php.net/manual/en/function.mb-strtoupper.php + * @link https://php.net/manual/en/function.mb-strtoupper.php * @param string $str

    * The string being uppercased. *

    @@ -7838,7 +8691,7 @@ function mb_str_to_upper ($str, $encoding = null) /** * Return width of string - * @link http://php.net/manual/en/function.mb-strwidth.php + * @link https://php.net/manual/en/function.mb-strwidth.php * @param string $str

    * The string being decoded. *

    @@ -7854,7 +8707,7 @@ function mb_str_width ($str, $encoding = null) /** * Returns the character count of string - * @link http://php.net/manual/en/function.iconv-strlen.php + * @link https://php.net/manual/en/function.iconv-strlen.php * @param string $str

    * The string. *

    @@ -7863,7 +8716,7 @@ function mb_str_width ($str, $encoding = null) * str is assumed to be encoded in * iconv.internal_encoding. *

    - * @return int the character count of str, as an integer. + * @return int|false the character count of str, as an integer. False on error. * @since 5.0 */ function iconv_str_len ($str, $charset = null) @@ -7873,7 +8726,7 @@ function iconv_str_len ($str, $charset = null) /** * Finds position of first occurrence of a needle within a haystack - * @link http://php.net/manual/en/function.iconv-strpos.php + * @link https://php.net/manual/en/function.iconv-strpos.php * @param string $haystack

    * The entire string. *

    @@ -7889,7 +8742,7 @@ function iconv_str_len ($str, $charset = null) * string are assumed to be encoded in * iconv.internal_encoding. *

    - * @return int the numeric position of the first occurrence of + * @return int|false the numeric position of the first occurrence of * needle in haystack. *

    *

    @@ -7904,7 +8757,7 @@ function iconv_str_pos ($haystack, $needle, $offset = 0, $charset = null) /** * Finds the last occurrence of a needle within a haystack - * @link http://php.net/manual/en/function.iconv-strrpos.php + * @link https://php.net/manual/en/function.iconv-strrpos.php * @param string $haystack

    * The entire string. *

    @@ -7916,7 +8769,7 @@ function iconv_str_pos ($haystack, $needle, $offset = 0, $charset = null) * string are assumed to be encoded in * iconv.internal_encoding. *

    - * @return int the numeric position of the last occurrence of + * @return int|false the numeric position of the last occurrence of * needle in haystack. *

    *

    @@ -7929,9 +8782,157 @@ function iconv_str_rpos ($haystack, $needle, $charset = null) return iconv_strrpos($haystack, $needle, $charset); } +/** + * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
    + * Find position (in grapheme units) of first occurrence of a case-insensitive string + * @link https://php.net/manual/en/function.grapheme-stripos.php + * @param string $haystack

    + * The string to look in. Must be valid UTF-8. + *

    + * @param string $needle

    + * The string to look for. Must be valid UTF-8. + *

    + * @param int $offset [optional]

    + * The optional $offset parameter allows you to specify where in haystack to + * start searching as an offset in grapheme units (not bytes or characters). + * The position returned is still relative to the beginning of haystack + * regardless of the value of $offset. + *

    + * @return int|false the position as an integer. If needle is not found, grapheme_stripos() will return boolean FALSE. + */ +function grapheme_str_ipos($haystack, $needle, $offset = 0) +{ + return grapheme_stripos($haystack, $needle, $offset); +} + +/** + * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
    + * Returns part of haystack string from the first occurrence of case-insensitive needle to the end of haystack. + * @link https://php.net/manual/en/function.grapheme-stristr.php + * @param string $haystack

    + * The input string. Must be valid UTF-8. + *

    + * @param string $needle

    + * The string to look for. Must be valid UTF-8. + *

    + * @param bool $before_needle [optional]

    + * If TRUE, grapheme_strstr() returns the part of the + * haystack before the first occurrence of the needle (excluding needle). + *

    + * @return string|false the portion of $haystack, or FALSE if $needle is not found. + */ +function grapheme_str_istr($haystack, $needle, $before_needle = false) +{ + return grapheme_stristr($haystack, $needle, $before_needle); +} + +/** + * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
    + * Get string length in grapheme units + * @link https://php.net/manual/en/function.grapheme-strlen.php + * @param string $input

    + * The string being measured for length. It must be a valid UTF-8 string. + *

    + * @return int|false|null The length of the string on success, and 0 if the string is empty. + */ +function grapheme_str_len($input) +{ + return grapheme_strlen($input); +} + +/** + * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
    + * Find position (in grapheme units) of first occurrence of a string + * @link https://php.net/manual/en/function.grapheme-strpos.php + * @param string $haystack

    + * The string to look in. Must be valid UTF-8. + *

    + * @param string $needle

    + * The string to look for. Must be valid UTF-8. + *

    + * @param int $offset [optional]

    + * The optional $offset parameter allows you to specify where in $haystack to + * start searching as an offset in grapheme units (not bytes or characters). + * The position returned is still relative to the beginning of haystack + * regardless of the value of $offset. + *

    + * @return int|false the position as an integer. If needle is not found, strpos() will return boolean FALSE. + */ +function grapheme_str_pos($haystack, $needle, $offset = 0) +{ + return grapheme_strpos($haystack, $needle, $offset); +} + +/** + * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
    + * Find position (in grapheme units) of last occurrence of a case-insensitive string + * @link https://php.net/manual/en/function.grapheme-strripos.php + * @param string $haystack

    + * The string to look in. Must be valid UTF-8. + *

    + * @param string $needle

    + * The string to look for. Must be valid UTF-8. + *

    + * @param int $offset [optional]

    + * The optional $offset parameter allows you to specify where in $haystack to + * start searching as an offset in grapheme units (not bytes or characters). + * The position returned is still relative to the beginning of haystack + * regardless of the value of $offset. + *

    + * @return int|false the position as an integer. If needle is not found, grapheme_strripos() will return boolean FALSE. + */ +function grapheme_str_ripos($haystack, $needle, $offset = 0) +{ + return grapheme_strripos($haystack, $needle, $offset); +} + +/** + * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
    + * Find position (in grapheme units) of last occurrence of a string + * @link https://php.net/manual/en/function.grapheme-strrpos.php + * @param string $haystack

    + * The string to look in. Must be valid UTF-8. + *

    + * @param string $needle

    + * The string to look for. Must be valid UTF-8. + *

    + * @param int $offset [optional]

    + * The optional $offset parameter allows you to specify where in $haystack to + * start searching as an offset in grapheme units (not bytes or characters). + * The position returned is still relative to the beginning of haystack + * regardless of the value of $offset. + *

    + * @return int|false the position as an integer. If needle is not found, grapheme_strrpos() will return boolean FALSE. + */ +function grapheme_str_rpos($haystack, $needle, $offset = 0) +{ + return grapheme_strrpos($haystack, $needle, $offset); +} + +/** + * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
    + * Returns part of haystack string from the first occurrence of needle to the end of haystack. + * @link https://php.net/manual/en/function.grapheme-strstr.php + * @param string $haystack

    + * The input string. Must be valid UTF-8. + *

    + * @param string $needle

    + * The string to look for. Must be valid UTF-8. + *

    + * @param bool $before_needle [optional]

    + * If TRUE, grapheme_strstr() returns the part of the + * haystack before the first occurrence of the needle (excluding the needle). + *

    + * @return string|false the portion of string, or FALSE if needle is not found. + */ +function grapheme_str_str($haystack, $needle, $before_needle = false) +{ + return grapheme_strstr($haystack, $needle, $before_needle); +} + /** * Sort an array - * @link http://php.net/manual/en/function.sort.php + * @link https://php.net/manual/en/function.sort.php * @param array $array

    * The input array. *

    @@ -7954,7 +8955,7 @@ function array_sort (array &$array, $sort_flags = null) /** * Sort an array in reverse order - * @link http://php.net/manual/en/function.rsort.php + * @link https://php.net/manual/en/function.rsort.php * @param array $array

    * The input array. *

    @@ -7974,7 +8975,7 @@ function array_sort_reverse (array &$array, $sort_flags = null) /** * Sort an array by values using a user-defined comparison function - * @link http://php.net/manual/en/function.usort.php + * @link https://php.net/manual/en/function.usort.php * @param array $array

    * The input array. *

    @@ -7994,7 +8995,7 @@ function array_usort (array &$array, $cmp_function) /** * Sort an array and maintain index association - * @link http://php.net/manual/en/function.asort.php + * @link https://php.net/manual/en/function.asort.php * @param array $array

    * The input array. *

    @@ -8014,7 +9015,7 @@ function array_sort_assoc (array &$array, $sort_flags = null) /** * Sort an array in reverse order and maintain index association - * @link http://php.net/manual/en/function.arsort.php + * @link https://php.net/manual/en/function.arsort.php * @param array $array

    * The input array. *

    @@ -8034,7 +9035,7 @@ function array_sort_assoc_reverse (array &$array, $sort_flags = null) /** * Sort an array with a user-defined comparison function and maintain index association - * @link http://php.net/manual/en/function.uasort.php + * @link https://php.net/manual/en/function.uasort.php * @param array $array

    * The input array. *

    @@ -8053,7 +9054,7 @@ function array_sort_uassoc (array &$array, $cmp_function) /** * Sort an array by key - * @link http://php.net/manual/en/function.ksort.php + * @link https://php.net/manual/en/function.ksort.php * @param array $array

    * The input array. *

    @@ -8073,7 +9074,7 @@ function array_sort_key (array &$array, $sort_flags = null) /** * Sort an array by key in reverse order - * @link http://php.net/manual/en/function.krsort.php + * @link https://php.net/manual/en/function.krsort.php * @param array $array

    * The input array. *

    @@ -8093,7 +9094,7 @@ function array_sort_key_reverse (array &$array, $sort_flags = null) /** * Sort an array by keys using a user-defined comparison function - * @link http://php.net/manual/en/function.uksort.php + * @link https://php.net/manual/en/function.uksort.php * @param array $array

    * The input array. *

    @@ -8119,7 +9120,7 @@ function array_sort_ukey (array &$array, $cmp_function) /** * Sort an array using a "natural order" algorithm - * @link http://php.net/manual/en/function.natsort.php + * @link https://php.net/manual/en/function.natsort.php * @param array $array

    * The input array. *

    @@ -8134,7 +9135,7 @@ function array_sort_natural (array &$array) /** * Sort an array using a case insensitive "natural order" algorithm - * @link http://php.net/manual/en/function.natcasesort.php + * @link https://php.net/manual/en/function.natcasesort.php * @param array $array

    * The input array. *

    @@ -8149,7 +9150,7 @@ function array_sort_natural_case (array &$array) /** * Checks if a value exists in an array - * @link http://php.net/manual/en/function.in-array.php + * @link https://php.net/manual/en/function.in-array.php * @param mixed $needle

    * The searched value. *

    @@ -8178,7 +9179,7 @@ function array_in ($needle, array $haystack, $strict = false) /** * Create an array containing a range of elements - * @link http://php.net/manual/en/function.range.php + * @link https://php.net/manual/en/function.range.php * @param mixed $start

    * First value of the sequence. *

    @@ -8203,7 +9204,7 @@ function array_range ($start, $end, $step = 1) /** * Shuffle an array - * @link http://php.net/manual/en/function.shuffle.php + * @link https://php.net/manual/en/function.shuffle.php * @param array $array

    * The array. *

    @@ -8216,9 +9217,62 @@ function array_shuffle (array &$array) return shuffle($array); } +/** + * Searches the array for a given value and returns the corresponding key if successful + * @link https://php.net/manual/en/function.array-search.php + * @param mixed $needle

    + * The searched value. + *

    + *

    + * If needle is a string, the comparison is done + * in a case-sensitive manner. + *

    + * @param array $haystack

    + * The array. + *

    + * @param bool $strict [optional]

    + * If the third parameter strict is set to true + * then the array_search function will also check the + * types of the + * needle in the haystack. + *

    + * @return int|string|false the key for needle if it is found in the + * array, false otherwise. + *

    + *

    + * If needle is found in haystack + * more than once, the first matching key is returned. To return the keys for + * all matching values, use array_keys with the optional + * search_value parameter instead. + * @since 4.0.5 + * @since 5.0 + */ +function array_find ($needle, array $haystack, $strict = null) +{ + return array_search($needle, $haystack, $strict); +} + +/** + * Checks if the given key or index exists in the array + * @link https://php.net/manual/en/function.array-key-exists.php + * @param mixed $key

    + * Value to check. + *

    + * @param array|ArrayObject $search

    + * An array with keys to check. + *

    + * @return bool true on success or false on failure. + * @since 4.0.7 + * @since 5.0 + */ +function array_key_find($key, array $search) +{ + return array_key_exists($key, $search); +} + /** * Gets information about a link - * @link http://php.net/manual/en/function.linkinfo.php + * @link https://php.net/manual/en/function.linkinfo.php * @param string $path

    * Path to the link. *

    @@ -8235,11 +9289,12 @@ function link_info ($path) /** * Gives information about a file or symbolic link - * @link http://php.net/manual/en/function.lstat.php + * @link https://php.net/manual/en/function.lstat.php + * @see stat * @param string $filename

    * Path to a file or a symbolic link. *

    - * @return array See the manual page for stat for information on + * @return array|false See the manual page for stat for information on * the structure of the array that lstat returns. * This function is identical to the stat function * except that if the filename parameter is a symbolic @@ -8255,7 +9310,7 @@ function link_stat ($filename) /** * Changes user ownership of symlink - * @link http://php.net/manual/en/function.lchown.php + * @link https://php.net/manual/en/function.lchown.php * @param string $filename

    * Path to the file. *

    @@ -8272,7 +9327,7 @@ function link_chown ($filename, $user) /** * Changes group ownership of symlink - * @link http://php.net/manual/en/function.lchgrp.php + * @link https://php.net/manual/en/function.lchgrp.php * @param string $filename

    * Path to the symlink. *

    @@ -8289,11 +9344,11 @@ function link_chgrp ($filename, $group) /** * Returns the target of a symbolic link - * @link http://php.net/manual/en/function.readlink.php + * @link https://php.net/manual/en/function.readlink.php * @param string $path

    * The symbolic link path. *

    - * @return string the contents of the symbolic link path or false on error. + * @return string|false the contents of the symbolic link path or false on error. * @since 4.0 * @since 5.0 */ @@ -8304,7 +9359,7 @@ function link_read ($path) /** * Creates a symbolic link - * @link http://php.net/manual/en/function.symlink.php + * @link https://php.net/manual/en/function.symlink.php * @param string $target

    * Target of the link. *

    @@ -8322,7 +9377,7 @@ function link_symbolic ($target, $link) /** * Returns filename component of path - * @link http://php.net/manual/en/function.basename.php + * @link https://php.net/manual/en/function.basename.php * @param string $path

    * A path. *

    @@ -8346,7 +9401,7 @@ function path_base_name ($path, $suffix = null) /** * Returns information about a file path - * @link http://php.net/manual/en/function.pathinfo.php + * @link https://php.net/manual/en/function.pathinfo.php * @param string $path

    * The path being checked. *

    @@ -8376,7 +9431,7 @@ function path_info ($path, $options = null) /** * Outputs a file - * @link http://php.net/manual/en/function.readfile.php + * @link https://php.net/manual/en/function.readfile.php * @param string $filename

    * The filename being read. *

    @@ -8400,7 +9455,7 @@ function file_read ($filename, $use_include_path = null, $context = null) /** * Closes process file pointer - * @link http://php.net/manual/en/function.pclose.php + * @link https://php.net/manual/en/function.pclose.php * @param resource $handle

    * The file pointer must be valid, and must have been returned by a * successful call to popen. @@ -8419,14 +9474,14 @@ function pipe_close ($handle) /** * Opens process file pointer - * @link http://php.net/manual/en/function.popen.php + * @link https://php.net/manual/en/function.popen.php * @param string $command

    * The command *

    * @param string $mode

    * The mode *

    - * @return bool|resource a file pointer identical to that returned by + * @return resource|false a file pointer identical to that returned by * fopen, except that it is unidirectional (may * only be used for reading or writing) and must be closed with * pclose. This pointer may be used with @@ -8445,11 +9500,11 @@ function pipe_open ($command, $mode) /** * Gets last access time of file - * @link http://php.net/manual/en/function.fileatime.php + * @link https://php.net/manual/en/function.fileatime.php * @param string $filename

    * Path to the file. *

    - * @return int|bool the time the file was last accessed, or false on failure. + * @return int|false the time the file was last accessed, or false on failure. * The time is returned as a Unix timestamp. * @since 4.0 * @since 5.0 @@ -8461,11 +9516,11 @@ function file_atime ($filename) /** * Gets inode change time of file - * @link http://php.net/manual/en/function.filectime.php + * @link https://php.net/manual/en/function.filectime.php * @param string $filename

    * Path to the file. *

    - * @return int|bool the time the file was last changed, or false on failure. + * @return int|false the time the file was last changed, or false on failure. * The time is returned as a Unix timestamp. * @since 4.0 * @since 5.0 @@ -8477,11 +9532,11 @@ function file_ctime ($filename) /** * Gets file group - * @link http://php.net/manual/en/function.filegroup.php + * @link https://php.net/manual/en/function.filegroup.php * @param string $filename

    * Path to the file. *

    - * @return int|bool the group ID of the file, or false in case + * @return int|false the group ID of the file, or false in case * of an error. The group ID is returned in numerical format, use * posix_getgrgid to resolve it to a group name. * Upon failure, false is returned. @@ -8495,11 +9550,11 @@ function file_group ($filename) /** * Gets file inode - * @link http://php.net/manual/en/function.fileinode.php + * @link https://php.net/manual/en/function.fileinode.php * @param string $filename

    * Path to the file. *

    - * @return int|bool the inode number of the file, or false on failure. + * @return int|false the inode number of the file, or false on failure. * @since 4.0 * @since 5.0 */ @@ -8510,11 +9565,11 @@ function file_inode ($filename) /** * Gets file modification time - * @link http://php.net/manual/en/function.filemtime.php + * @link https://php.net/manual/en/function.filemtime.php * @param string $filename

    * Path to the file. *

    - * @return int|bool the time the file was last modified, or false on failure. + * @return int|false the time the file was last modified, or false on failure. * The time is returned as a Unix timestamp, which is * suitable for the date function. * @since 4.0 @@ -8527,11 +9582,11 @@ function file_mtime ($filename) /** * Gets file owner - * @link http://php.net/manual/en/function.fileowner.php + * @link https://php.net/manual/en/function.fileowner.php * @param string $filename

    * Path to the file. *

    - * @return int|bool the user ID of the owner of the file, or false on failure. + * @return int|false the user ID of the owner of the file, or false on failure. * The user ID is returned in numerical format, use * posix_getpwuid to resolve it to a username. * @since 4.0 @@ -8544,11 +9599,11 @@ function file_owner ($filename) /** * Gets file permissions - * @link http://php.net/manual/en/function.fileperms.php + * @link https://php.net/manual/en/function.fileperms.php * @param string $filename

    * Path to the file. *

    - * @return int|bool the permissions on the file, or false on failure. + * @return int|false the permissions on the file, or false on failure. * @since 4.0 * @since 5.0 */ @@ -8559,11 +9614,11 @@ function file_perms ($filename) /** * Gets file size - * @link http://php.net/manual/en/function.filesize.php + * @link https://php.net/manual/en/function.filesize.php * @param string $filename

    * Path to the file. *

    - * @return int the size of the file in bytes, or false (and generates an error + * @return int|false the size of the file in bytes, or false (and generates an error * of level E_WARNING) in case of an error. * @since 4.0 * @since 5.0 @@ -8575,11 +9630,11 @@ function file_size ($filename) /** * Gets file type - * @link http://php.net/manual/en/function.filetype.php + * @link https://php.net/manual/en/function.filetype.php * @param string $filename

    * Path to the file. *

    - * @return string the type of the file. Possible values are fifo, char, + * @return string|false the type of the file. Possible values are fifo, char, * dir, block, link, file, socket and unknown. *

    *

    @@ -8596,7 +9651,7 @@ function file_type ($filename) /** * Match filename against a pattern - * @link http://php.net/manual/en/function.fnmatch.php + * @link https://php.net/manual/en/function.fnmatch.php * @param string $pattern

    * The shell wildcard pattern. *

    @@ -8659,7 +9714,7 @@ function file_name_match ($pattern, $string, $flags = null) /** * Create file with unique file name - * @link http://php.net/manual/en/function.tempnam.php + * @link https://php.net/manual/en/function.tempnam.php * @param string $dir

    * The directory where the temporary filename will be created. *

    @@ -8667,7 +9722,7 @@ function file_name_match ($pattern, $string, $flags = null) * The prefix of the generated temporary filename. *

    * Windows use only the first three characters of prefix. - * @return bool|string the new temporary filename, or false on + * @return string|false the new temporary filename, or false on * failure. * @since 4.0 * @since 5.0 @@ -8679,7 +9734,7 @@ function file_temp_name ($dir, $prefix) /** * Copies file - * @link http://php.net/manual/en/function.copy.php + * @link https://php.net/manual/en/function.copy.php * @param string $source

    * Path to the source file. *

    @@ -8706,11 +9761,11 @@ function file_copy ($source, $dest, $context = null) /** * Gives information about a file - * @link http://php.net/manual/en/function.stat.php + * @link https://php.net/manual/en/function.stat.php * @param string $filename

    * Path to the file. *

    - * @return array
  • * Silently discard invalid code unit sequences instead of returning * an empty string. Using this flag is discouraged as it - * {@link http://unicode.org/reports/tr36/#Deletion_of_Noncharacters » may have security implications}. + * {@link https://unicode.org/reports/tr36/#Deletion_of_Noncharacters » may have security implications}. *
      * An empty string activates detection from script encoding (Zend multibyte), - * {@link http://php.net/manual/en/ini.core.php#ini.default-charset default_charset} and current - * locale {@link http://php.net/manual/en/function.nl-langinfo.php nl_langinfo()} and - * {@link http://php.net/manual/en/function.setlocale.php setlocale()}), in this order. Not recommended. + * {@link https://php.net/manual/en/ini.core.php#ini.default-charset default_charset} and current + * locale {@link https://php.net/manual/en/function.nl-langinfo.php nl_langinfo()} and + * {@link https://php.net/manual/en/function.setlocale.php setlocale()}), in this order. Not recommended. *
    P_SIGN_POSN
    + * @return array|false
    * stat and fstat result * format * @@ -8802,7 +9857,7 @@ function file_stat ($filename) /** * Clears file status cache - * @link http://php.net/manual/en/function.clearstatcache.php + * @link https://php.net/manual/en/function.clearstatcache.php * @param bool $clear_realpath_cache [optional]

    * Whenever to clear realpath cache or not. *

    @@ -8819,9 +9874,36 @@ function file_stat_clear_cache ($clear_realpath_cache = null, $filename = null) return clearstatcache($clear_realpath_cache, $filename); } +/** + * Moves an uploaded file to a new location + * @link https://php.net/manual/en/function.move-uploaded-file.php + * @param string $filename

    + * The filename of the uploaded file. + *

    + * @param string $destination

    + * The destination of the moved file. + *

    + * @return bool If filename is not a valid upload file, + * then no action will occur, and + * move_uploaded_file will return + * false. + *

    + *

    + * If filename is a valid upload file, but + * cannot be moved for some reason, no action will occur, and + * move_uploaded_file will return + * false. Additionally, a warning will be issued. + * @since 4.0.3 + * @since 5.0 + */ +function file_move_uploaded ($filename, $destination) +{ + return move_uploaded_file($filename, $destination); +} + /** * Deletes a file - * @link http://php.net/manual/en/function.unlink.php + * @link https://php.net/manual/en/function.unlink.php * @param string $filename

    * Path to the file. *

    @@ -8830,14 +9912,14 @@ function file_stat_clear_cache ($clear_realpath_cache = null, $filename = null) * @since 4.0 * @since 5.0 */ -function file_delete ($filename, $context = null) +function file_delete ($filename, $context = null):bool { return unlink($filename, $context); } /** * Renames a file or directory - * @link http://php.net/manual/en/function.rename.php + * @link https://php.net/manual/en/function.rename.php * @param string $oldname

    *

    *

    @@ -8860,7 +9942,7 @@ function file_rename ($oldname, $newname, $context = null) /** * Gets line from file pointer and parse for CSV fields - * @link http://php.net/manual/en/function.fgetcsv.php + * @link https://php.net/manual/en/function.fgetcsv.php * @param resource $handle

    * A valid file pointer to a file successfully opened by * fopen, popen, or @@ -8904,7 +9986,7 @@ function fget_csv ($handle, $length = 0, $delimiter = ',', $enclosure = '"', $es /** * Format line as CSV and write to file pointer - * @link http://php.net/manual/en/function.fputcsv.php + * @link https://php.net/manual/en/function.fputcsv.php * @param resource $handle The file pointer must be valid, and must point to a file successfully opened by fopen() or fsockopen() (and not yet closed by fclose()). * @param array $fields

    * An array of values. @@ -8918,7 +10000,7 @@ function fget_csv ($handle, $length = 0, $delimiter = ',', $enclosure = '"', $es * enclosure (one character only). *

    * @param string $escape_char The optional escape_char parameter sets the escape character (one character only). - * @return int|bool the length of the written string or false on failure. + * @return int|false the length of the written string or false on failure. * @since 5.1.0 */ function fput_csv ($handle, array $fields, $delimiter = ",", $enclosure = '"', $escape_char = "\\") @@ -8928,7 +10010,7 @@ function fput_csv ($handle, array $fields, $delimiter = ",", $enclosure = '"', $ /** * Rewind the position of a file pointer - * @link http://php.net/manual/en/function.rewind.php + * @link https://php.net/manual/en/function.rewind.php * @param resource $handle

    * The file pointer must be valid, and must point to a file * successfully opened by fopen. @@ -8944,8 +10026,8 @@ function frewind ($handle) /** * Creates a temporary file - * @link http://php.net/manual/en/function.tmpfile.php - * @return resource|bool a file handle, similar to the one returned by + * @link https://php.net/manual/en/function.tmpfile.php + * @return resource|false a file handle, similar to the one returned by * fopen, for the new file or false on failure. * @since 4.0 * @since 5.0 @@ -8957,7 +10039,7 @@ function ftemp () /** * Delay execution - * @link http://php.net/manual/en/function.sleep.php + * @link https://php.net/manual/en/function.sleep.php * @param int $seconds

    * Halt time in seconds. *

    @@ -8974,7 +10056,7 @@ function time_sleep ($seconds) /** * Delay for a number of seconds and nanoseconds - * @link http://php.net/manual/en/function.time-nanosleep.php + * @link https://php.net/manual/en/function.time-nanosleep.php * @param int $seconds

    * Must be a positive integer. *

    @@ -8999,7 +10081,7 @@ function time_nano_sleep ($seconds, $nanoseconds) /** * Delay execution in microseconds - * @link http://php.net/manual/en/function.usleep.php + * @link https://php.net/manual/en/function.usleep.php * @param int $micro_seconds

    * Halt time in micro seconds. A micro second is one millionth of a * second. @@ -9015,7 +10097,7 @@ function time_micro_sleep ($micro_seconds) /** * Generate a unique ID - * @link http://php.net/manual/en/function.uniqid.php + * @link https://php.net/manual/en/function.uniqid.php * @param string $prefix [optional]

    * Can be useful, for instance, if you generate identifiers * simultaneously on several hosts that might happen to generate the @@ -9042,7 +10124,7 @@ function time_unique_id ($prefix = "", $more_entropy = false) /** * Gets system load average - * @link http://php.net/manual/en/function.sys-getloadavg.php + * @link https://php.net/manual/en/function.sys-getloadavg.php * @return array an array with three samples (last 1, 5 and 15 * minutes). * @since 5.1.3 @@ -9054,7 +10136,7 @@ function sys_get_load_avg () /** * Return source with stripped comments and whitespace - * @link http://php.net/manual/en/function.php-strip-whitespace.php + * @link https://php.net/manual/en/function.php-strip-whitespace.php * @param string $filename

    * Path to the PHP file. *

    @@ -9075,7 +10157,7 @@ function php_strip_white_space ($filename) /** * Decodes URL-encoded string - * @link http://php.net/manual/en/function.urldecode.php + * @link https://php.net/manual/en/function.urldecode.php * @param string $str

    * The string to be decoded. *

    @@ -9090,7 +10172,7 @@ function url_decode ($str) /** * URL-encodes string - * @link http://php.net/manual/en/function.urlencode.php + * @link https://php.net/manual/en/function.urlencode.php * @param string $str

    * The string to be encoded. *

    @@ -9113,7 +10195,7 @@ function url_encode ($str) /** * Decode URL-encoded strings - * @link http://php.net/manual/en/function.rawurldecode.php + * @link https://php.net/manual/en/function.rawurldecode.php * @param string $str

    * The URL to be decoded. *

    @@ -9128,7 +10210,7 @@ function url_raw_decode ($str) /** * URL-encode according to RFC 1738 - * @link http://php.net/manual/en/function.rawurlencode.php + * @link https://php.net/manual/en/function.rawurlencode.php * @param string $str

    * The URL to be encoded. *

    @@ -9149,7 +10231,7 @@ function url_raw_encode ($str) /** * Parse a URL and return its components - * @link http://php.net/manual/en/function.parse-url.php + * @link https://php.net/manual/en/function.parse-url.php * @param string $url

    * The URL to parse. Invalid characters are replaced by * _. @@ -9185,9 +10267,48 @@ function url_parse ($url, $component = -1) return parse_url($url, $component); } +/** + * Generate URL-encoded query string + * @link https://php.net/manual/en/function.http-build-query.php + * @param mixed $query_data

    + * May be an array or object containing properties. + *

    + *

    + * If query_data is an array, it may be a simple one-dimensional structure, + * or an array of arrays (which in turn may contain other arrays). + *

    + *

    + * If query_data is an object, then only public properties will be incorporated into the result. + *

    + * @param string $numeric_prefix [optional]

    + * If numeric indices are used in the base array and this parameter is + * provided, it will be prepended to the numeric index for elements in + * the base array only. + *

    + *

    + * This is meant to allow for legal variable names when the data is + * decoded by PHP or another CGI application later on. + *

    + * @param string $arg_separator [optional]

    + * arg_separator.output + * is used to separate arguments, unless this parameter is specified, + * and is then used. + *

    + * @param int $enc_type By default, PHP_QUERY_RFC1738. + *

    If enc_type is PHP_QUERY_RFC1738, then encoding is performed per » RFC 1738 and the application/x-www-form-urlencoded media type, + * which implies that spaces are encoded as plus (+) signs. + *

    If enc_type is PHP_QUERY_RFC3986, then encoding is performed according to » RFC 3986, and spaces will be percent encoded (%20). + * @return string a URL-encoded string. + * @since 5.0 + */ +function url_build_query ($query_data, $numeric_prefix = null, $arg_separator = null, $enc_type = PHP_QUERY_RFC1738) +{ + return http_build_query($query_data, $numeric_prefix, $arg_separator, $enc_type); +} + /** * Extracts all meta tag content attributes from a file and returns an array - * @link http://php.net/manual/en/function.get-meta-tags.php + * @link https://php.net/manual/en/function.get-meta-tags.php * @param string $filename

    * The path to the HTML file, as a string. This can be a local file or an * URL. @@ -9223,7 +10344,7 @@ function url_meta_tags ($filename, $use_include_path = null) /** * Fetches all the headers sent by the server in response to a HTTP request - * @link http://php.net/manual/en/function.get-headers.php + * @link https://php.net/manual/en/function.get-headers.php * @param string $url

    * The target URL. *

    @@ -9233,18 +10354,18 @@ function url_meta_tags ($filename, $use_include_path = null) * array's keys. *

    * @param resource $context [optional] - * @return array an indexed or associative array with the headers, or false on + * @return array|false an indexed or associative array with the headers, or false on * failure. * @since 5.0 */ -function url_headers ($url, $format = null, $context) +function url_headers ($url, $format = null, $context = null) { return get_headers($url, $format, $context); } /** * Prints out the credits for PHP - * @link http://php.net/manual/en/function.phpcredits.php + * @link https://php.net/manual/en/function.phpcredits.php * @param int $flag [optional]

    * To generate a custom credits page, you may want to use the * flag parameter. @@ -9314,7 +10435,7 @@ function php_credits ($flag = null) /** * Outputs lots of PHP information - * @link http://php.net/manual/en/function.phpinfo.php + * @link https://php.net/manual/en/function.phpinfo.php * @param int $what [optional]

    * The output may be customized by passing one or more of the * following constants bitwise values summed @@ -9405,7 +10526,7 @@ function php_info ($what = null) /** * Gets the current PHP version - * @link http://php.net/manual/en/function.phpversion.php + * @link https://php.net/manual/en/function.phpversion.php * @param string $extension [optional]

    * An optional extension name. *

    @@ -9423,7 +10544,7 @@ function php_version ($extension = null) /** * Gets options from the command line argument list - * @link http://php.net/manual/en/function.getopt.php + * @link https://php.net/manual/en/function.getopt.php * @param string $options Each character in this string will be used as option characters and * matched against options passed to the script starting with a single * hyphen (-). @@ -9449,7 +10570,7 @@ function get_opt ($options, array $longopts = null, &$optind = null) /** * Gets the value of an environment variable - * @link http://php.net/manual/en/function.getenv.php + * @link https://php.net/manual/en/function.getenv.php * @param string $varname [optional]

    * The variable name. *

    @@ -9472,7 +10593,7 @@ function get_env ($varname = null, $local_only = false) /** * Sets the value of an environment variable - * @link http://php.net/manual/en/function.putenv.php + * @link https://php.net/manual/en/function.putenv.php * @param string $setting

    * The setting, like "FOO=BAR" *

    @@ -9487,7 +10608,7 @@ function put_env ($setting) /** * Gets time of last page modification - * @link http://php.net/manual/en/function.getlastmod.php + * @link https://php.net/manual/en/function.getlastmod.php * @return int the time of the last modification of the current * page. The value returned is a Unix timestamp, suitable for * feeding to date. Returns false on error. @@ -9501,7 +10622,7 @@ function get_last_mod () /** * Get PHP script owner's GID - * @link http://php.net/manual/en/function.getmygid.php + * @link https://php.net/manual/en/function.getmygid.php * @return int the group ID of the current script, or false on error. * @since 4.1.0 * @since 5.0 @@ -9513,7 +10634,7 @@ function get_my_gid () /** * Gets the inode of the current script - * @link http://php.net/manual/en/function.getmyinode.php + * @link https://php.net/manual/en/function.getmyinode.php * @return int the current script's inode as an integer, or false on error. * @since 4.0 * @since 5.0 @@ -9525,7 +10646,7 @@ function get_my_inode () /** * Gets PHP's process ID - * @link http://php.net/manual/en/function.getmypid.php + * @link https://php.net/manual/en/function.getmypid.php * @return int the current PHP process ID, or false on error. * @since 4.0 * @since 5.0 @@ -9537,7 +10658,7 @@ function get_my_pid () /** * Gets PHP script owner's UID - * @link http://php.net/manual/en/function.getmyuid.php + * @link https://php.net/manual/en/function.getmyuid.php * @return int the user ID of the current script, or false on error. * @since 4.0 * @since 5.0 @@ -9549,7 +10670,7 @@ function get_my_uid () /** * Gets the current resource usages - * @link http://php.net/manual/en/function.getrusage.php + * @link https://php.net/manual/en/function.getrusage.php * @param int $who [optional]

    * If who is 1, getrusage will be called with * RUSAGE_CHILDREN. @@ -9564,12 +10685,24 @@ function get_rusage ($who = null) return getrusage($who); } +/** + * (PHP 5.5.0)
    + * Get the boolean value of a variable + * @param mixed $var

    the scalar value being converted to a boolean.

    + * @return bool The boolean value of var. + * @since 5.5.0 + */ +function bool_val($var) +{ + return boolval($var); +} + /** * (PHP 4.2.0, PHP 5)
    * Alias of floatval() * Get float value of a variable * &Alias; floatval - * @link http://php.net/manual/en/function.doubleval.php + * @link https://php.net/manual/en/function.doubleval.php * @param mixed $var May be any scalar type. should not be used on objects, as doing so will emit an E_NOTICE level error and return 1. * @return float value of the given variable. Empty arrays return 0, non-empty arrays return 1. */ @@ -9580,7 +10713,7 @@ function double_val ($var) /** * Get float value of a variable - * @link http://php.net/manual/en/function.floatval.php + * @link https://php.net/manual/en/function.floatval.php * @param mixed $var May be any scalar type. should not be used on objects, as doing so will emit an E_NOTICE level error and return 1. * @return float value of the given variable. Empty arrays return 0, non-empty arrays return 1. * @since 4.2.0 @@ -9593,7 +10726,7 @@ function float_val ($var) /** * Get the integer value of a variable - * @link http://php.net/manual/en/function.intval.php + * @link https://php.net/manual/en/function.intval.php * @param mixed $var

    * The scalar value being converted to an integer *

    @@ -9626,7 +10759,7 @@ function int_val ($var, $base = null) /** * Get string value of a variable - * @link http://php.net/manual/en/function.strval.php + * @link https://php.net/manual/en/function.strval.php * @param mixed $var

    * The variable that is being converted to a string. *

    @@ -9645,7 +10778,7 @@ function str_val ($var) /** * Get the type of a variable - * @link http://php.net/manual/en/function.gettype.php + * @link https://php.net/manual/en/function.gettype.php * @param mixed $var

    * The variable being type checked. *

    @@ -9671,7 +10804,7 @@ function type_get ($var) /** * Set the type of a variable - * @link http://php.net/manual/en/function.settype.php + * @link https://php.net/manual/en/function.settype.php * @param mixed $var

    * The variable being converted. *

    @@ -9712,7 +10845,7 @@ function type_set (&$var, $type) /** * Returns the resource type - * @link http://php.net/manual/en/function.get-resource-type.php + * @link https://php.net/manual/en/function.get-resource-type.php * @param resource $handle

    * The evaluated resource handle. *

    @@ -9734,7 +10867,7 @@ function type_resource ($handle) /** * Returns an array of all defined variables - * @link http://php.net/manual/en/function.get-defined-vars.php + * @link https://php.net/manual/en/function.get-defined-vars.php * @return array A multidimensional array with all the variables. * @since 4.0.4 * @since 5.0 @@ -9746,7 +10879,7 @@ function php_defined_vars () /** * the "Late Static Binding" class name - * @link http://php.net/manual/en/function.get-called-class.php + * @link https://php.net/manual/en/function.get-called-class.php * @return string the class name. Returns false if called from outside a class. * @since 5.3.0 */ @@ -9757,7 +10890,7 @@ function class_called () /** * Gets the class methods' names - * @link http://php.net/manual/en/function.get-class-methods.php + * @link https://php.net/manual/en/function.get-class-methods.php * @param mixed $class_name

    * The class name or an object instance *

    @@ -9773,7 +10906,7 @@ function class_methods ($class_name) /** * Get the default properties of the class - * @link http://php.net/manual/en/function.get-class-vars.php + * @link https://php.net/manual/en/function.get-class-vars.php * @param string $class_name

    * The class name *

    @@ -9791,7 +10924,7 @@ function class_vars ($class_name) /** * Returns the name of the class of an object - * @link http://php.net/manual/en/function.get-class.php + * @link https://php.net/manual/en/function.get-class.php * @param object $object [optional]

    * The tested object. This parameter may be omitted when inside a class. *

    @@ -9812,7 +10945,7 @@ function class_get ($object = null) /** * Retrieves the parent class name for object or class - * @link http://php.net/manual/en/function.get-parent-class.php + * @link https://php.net/manual/en/function.get-parent-class.php * @param mixed $object [optional]

    * The tested object or class name *

    @@ -9834,11 +10967,11 @@ function class_parent ($object = null) /** * Gets the properties of the given object - * @link http://php.net/manual/en/function.get-object-vars.php + * @link https://php.net/manual/en/function.get-object-vars.php * @param object $object

    * An object instance. *

    - * @return array an associative array of defined object accessible non-static properties + * @return array an associative array of defined object accessible non-static properties * for the specified object in scope. If a property have * not been assigned a value, it will be returned with a null value. * @since 4.0 @@ -9851,7 +10984,7 @@ function class_object_vars ($object) /** * Returns an array with the name of the defined classes - * @link http://php.net/manual/en/function.get-declared-classes.php + * @link https://php.net/manual/en/function.get-declared-classes.php * @return array an array of the names of the declared classes in the current * script. *

    @@ -9871,7 +11004,7 @@ function class_declared () /** * Returns an array of all declared interfaces - * @link http://php.net/manual/en/function.get-declared-interfaces.php + * @link https://php.net/manual/en/function.get-declared-interfaces.php * @return array an array of the names of the declared interfaces in the current * script. * @since 5.0 @@ -9881,9 +11014,21 @@ function interface_declared () return get_declared_interfaces(); } +/** + * Returns an array of all declared traits + * @return array with names of all declared traits in values. Returns NULL in case of a failure. + * @link https://secure.php.net/manual/en/function.get-declared-traits.php + * @see class_uses() + * @since 5.4.0 + */ +function trait_declared() +{ + return get_declared_traits(); +} + /** * Find out whether an extension is loaded - * @link http://php.net/manual/en/function.extension-loaded.php + * @link https://php.net/manual/en/function.extension-loaded.php * @param string $name

    * The extension name. *

    @@ -9922,7 +11067,7 @@ function php_extension_loaded ($name) /** * Returns an array with the names of all modules compiled and loaded - * @link http://php.net/manual/en/function.get-loaded-extensions.php + * @link https://php.net/manual/en/function.get-loaded-extensions.php * @param bool $zend_extensions [optional]

    * Only return Zend extensions, if not then regular extensions, like * mysqli are listed. Defaults to false (return regular extensions). @@ -9938,14 +11083,14 @@ function php_extension_loaded_all ($zend_extensions = false) /** * Returns an array with the names of the functions of a module - * @link http://php.net/manual/en/function.get-extension-funcs.php + * @link https://php.net/manual/en/function.get-extension-funcs.php * @param string $module_name

    * The module name. *

    *

    * This parameter must be in lowercase. *

    - * @return array an array with all the functions, or false if + * @return array an array with all the functions, or false if * module_name is not a valid extension. * @since 4.0 * @since 5.0 @@ -9958,7 +11103,7 @@ function php_extension_functions ($module_name) /** * @deprecated 5.3.0 since 5.3.0 * Loads a PHP extension at runtime - * @link http://php.net/manual/en/function.dl.php + * @link https://php.net/manual/en/function.dl.php * @param string $library

    * This parameter is only the filename of the * extension to load which also depends on your platform. For example, @@ -9998,7 +11143,7 @@ function php_dl ($library) /** * Gets the value of a PHP configuration option - * @link http://php.net/manual/en/function.get-cfg-var.php + * @link https://php.net/manual/en/function.get-cfg-var.php * @param string $option

    * The configuration option name. *

    @@ -10014,7 +11159,7 @@ function php_cfg_var ($option) /** * Gets the name of the owner of the current PHP script - * @link http://php.net/manual/en/function.get-current-user.php + * @link https://php.net/manual/en/function.get-current-user.php * @return string the username as a string. * @since 4.0 * @since 5.0 @@ -10026,7 +11171,7 @@ function php_current_user () /** * Returns an associative array with the names of all the constants and their values - * @link http://php.net/manual/en/function.get-defined-constants.php + * @link https://php.net/manual/en/function.get-defined-constants.php * @param bool $categorize [optional]

    * Causing this function to return a multi-dimensional * array with categories in the keys of the first dimension and constants @@ -10083,7 +11228,7 @@ function php_defined_constants ($categorize = false) /** * Gets the current include_path configuration option - * @link http://php.net/manual/en/function.get-include-path.php + * @link https://php.net/manual/en/function.get-include-path.php * @return string the path, as a string. * @since 4.3.0 * @since 5.0 @@ -10095,7 +11240,7 @@ function php_include_path_get () /** * Sets the include_path configuration option - * @link http://php.net/manual/en/function.set-include-path.php + * @link https://php.net/manual/en/function.set-include-path.php * @param string $new_include_path

    * The new value for the include_path *

    @@ -10111,7 +11256,7 @@ function php_include_path_set ($new_include_path) /** * Restores the value of the include_path configuration option - * @link http://php.net/manual/en/function.restore-include-path.php + * @link https://php.net/manual/en/function.restore-include-path.php * @return void * @since 4.3.0 * @since 5.0 @@ -10123,7 +11268,7 @@ function php_include_path_restore () /** * Returns an array with the names of included or required files - * @link http://php.net/manual/en/function.get-included-files.php + * @link https://php.net/manual/en/function.get-included-files.php * @return string[] an array of the names of all files. *

    *

    @@ -10144,7 +11289,7 @@ function php_included_files () /** * Alias of get_included_files - * @link http://php.net/manual/en/function.get-required-files.php + * @link https://php.net/manual/en/function.get-required-files.php * @return string[] * @since 4.0 * @since 5.0 @@ -10156,7 +11301,7 @@ function php_required_files () /** * Limits the maximum execution time - * @link http://php.net/manual/en/function.set-time-limit.php + * @link https://php.net/manual/en/function.set-time-limit.php * @param int $seconds

    * The maximum execution time, in seconds. If set to zero, no time limit * is imposed.