사이트 내 전체검색
ereg / eregi 오류 Function eregi() is deprecated in 처리
로빈아빠
https://cmd.kr/javascript/831 URL이 복사되었습니다.

본문

ideprecated Fix  in PHP

Function ereg() is deprecated
Function eregi() is deprecated in 
Function eregi_replace() is deprecated in 

1) php ini change 
//set the level of error reporting
error_reporting(E_ALL & ~E_NOTICE); 
->
//set the level of error reporting
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);



eregi 변환예) examples;

if(!eregi("^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$", $str)) {
if(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $str)) {


$title=ereg_replace(" ", "+", $itemurl);
$title=preg_replace("/ /", "+", $itemurl);


if (!ereg('^[[:alnum:]]+[[:alnum:].]+$', $name)) {
if (!preg_match('#^[[:alnum:]]+[[:alnum:].]+$#', $name)) {

if (!@ereg('^[[:alnum:]]+[[:alnum:].]+$', $name)) {
if (!@preg_match('#^[[:alnum:]]+[[:alnum:].]+$#', $name)) {


$string = ereg_replace(' +', ' ', trim($string));
$string = preg_replace('{ +}', ' ', trim($string));

ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)))
preg_replace('{2037\z}', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)))

ereg_replace('"', ' ', $pieces[$k])
str_replace('"', ' ', $pieces[$k])

ereg_replace('(' . implode('|', $from) . ')', $to, $string)
preg_replace('{(' . implode('|', $from) . ')}', $to, $string)

ereg_replace('[^0-9]', '', $number)
preg_replace('{\D}', '', $number)

ereg_replace('-language', '-' . $languages[$j]['directory'], $cached_file)
str_replace('-language', '-' . $languages[$j]['directory'], $cached_file)

ereg_replace("\r","",$which_text)
str_replace("\r","",$which_text)

ereg_replace('-language', '-' . $language, $cache_blocks[$i]['file'])
str_replace('-language', '-' . $language, $cache_blocks[$i]['file'])

ereg_replace(",\n$", '', $schema)
preg_replace("{,\n\z}", '', $schema)

ereg_replace("\n#", "\n".'\#', $row)
preg_replace("{\n#}", "\n".'\#', $row)

ereg_replace(', $', '', $schema)
preg_replace('{, \z}', '', $schema)

$pieces = split('[[:space:]]+', $search_str)
$pieces = preg_split("/[\s,]+/", $search_str);

if (ereg('->', $use_function)) {
if (preg_match('{->}', $use_function)) {

if (ereg('^[0-9]$', $char)) $rand_value .= $char;
if (preg('/^[0-9]$/', $char)) $rand_value .= $char;

if (ereg('^[0-9]$', $char)) $rand_value .= $char;
if (preg_match('^[0-9]$', $char)) $rand_value .= $char;

ereg('\.([^\.]*$)', $this->file_src_name, $extension);
preg_match('/\.([^\.]*$)/', $this->file_src_name, $extension);

ereg_replace('[^A-Za-z0-9_]', '', $this->file_dst_name_body);
preg_replace('/[^A-Za-z0-9_]/', '', $this->file_dst_name_body);

eregi('\.([^\.]*$)', $this->file_src_name, $extension);
preg_match('/\.([^\.]*$)/i', $this->file_src_name, $extension);

ereg($startreg['format'], $date, $regs);
preg_match('/'.$startreg['format'].'/', $date, $regs);

eregi ("\@.()+_*^%$#\.[;]", $branchname)
preg_match('/\@.()+_*^%$#\.[;]/i', 'your_second_arument', $branchname)

if (eregi($Match, $_SERVER['HTTP_USER_AGENT']))
if (preg_match('/$Match/i',$_SERVER['HTTP_USER_AGENT']))

if (!eregi('^' . DIR_FS_DOCUMENT_ROOT, $current_path)) $current_path = DIR_FS_DOCUMENT_ROOT
if (!preg_match('#^' . DIR_FS_DOCUMENT_ROOT.'#i', $current_path)) $current_path = DIR_FS_DOCUMENT_ROOT;

$string = preg_replace(sql_regcase("/(from|select|insert|delete|where|drop table|show tables|#|\*|--|\\\\)/"),"",$string);
$string = preg_replace("/(from|select|insert|delete|where|drop table|show tables|#|\*|--|\\\\)/i","",$string)

ereg(‘^([^=]*)=["\']?([^"\']*)["\']?$’,$v,$a3)
preg_match(‘/^([^=]*)=["\']?([^"\']*)["\']?$/’, $v, $a3)

ereg(‘^([^=]*)=["\']?([^"\']*)["\']?$’,$v,$a3)
preg_match(‘/^([^=]*)=["\']?([^"\']*)["\']?$/’, $v, $a3)


ereg('([a-z]{1,2})(-([a-z0-9]+))?(;q=([0-9\.]+))?',$lang,$found);
preg_match_all('/([a-z]{1,2})(-([a-z0-9]+))?(;q=([0-9\.]+))?/', $lang, $found);


댓글목록

등록된 댓글이 없습니다.

831 (2/17P)

Search

Copyright © Cmd 명령어 18.226.214.91