
PHP: risolvere l’errore “Function eregi() is deprecated”
Potresti aver già riscontrato questo messaggio di avviso programmando in PHP:
Function eregi() is deprecated.
Difatti, “deprecated” significa che PHP considera questa funzione obsoleta, quindi è come se la funzione ereg()
non esistesse più. Pertanto, è meglio ora utilizzare la funzione che ha preso il suo posto.
La funzione ereg()
o eregi()
è quindi rimpiattata dalla funzione preg_match() dalla versione PHP 5.3 :
$is_image = eregi( "jpg|gif",$file_type );
Diventa quindi:
$is_image = preg_match( “~jpg|gif~i”,$file_type );
Ecco l’elenco delle funzioni che sono diventate obsolete a partire da PHP 5.3:
call_user_method() (use call_user_func() instead) call_user_method_array() (use call_user_func_array() instead) define_syslog_variables() dl() ereg() (use preg_match() instead) ereg_replace() (use preg_replace() instead) eregi() (use preg_match() with the ‘i’ modifier instead) eregi_replace() (use preg_replace() with the ‘i’ modifier instead) set_magic_quotes_runtime() and its alias, magic_quotes_runtime() session_register() (use the $_SESSION superglobal instead) session_unregister() (use the $_SESSION superglobal instead) session_is_registered() (use the $_SESSION superglobal instead) set_socket_blocking() (use stream_set_blocking() instead) split() (use preg_split() instead) spliti() (use preg_split() with the ‘i’ modifier instead) sql_regcase() mysql_db_query() (use mysql_select_db() and mysql_query() instead) mysql_escape_string() (use mysql_real_escape_string() instead) Passing locale category names as strings is now deprecated. Use the LC_* family of constants instead. The is_dst parameter to mktime(). Use the new timezone handling functions instead.
Ricordatevi sempre che lo sviluppo è una forma d’arte.
I nostri corsi : https://www.develop4fun.it/premium-corsi-online-in-abbonamento
▼ SEGUICI SU ▼
» Facebook (italiano): https://www.facebook.com/develop4funwebdev
» Facebook (francese): https://www.facebook.com/developforfun
» Instagram: https://www.instagram.com/develop4fun
» Twitter: https://twitter.com/Develop4funW
» VISITA IL NOSTRO SITO WEB: https://www.develop4fun.it/
» ISCRIVITI SUBITO AL NOSTRO CANALE: https://www.youtube.com/channel/UCZ4dhshzpVbbRPVuL9TNH4Q