mysql> SELECT REGEXP_REPLACE('a b c', 'b', 'X');
+-----------------------------------+
| REGEXP_REPLACE('a b c', 'b', 'X') |
+-----------------------------------+
| a X c |
+-----------------------------------+
UPDATE `site_content` SET `content` = REGEXP_REPLACE(content, 'title="Иллюстрация [0-9]+"', '')
UPDATE table SET uid = CASE
WHEN id = 1 THEN 2952
WHEN id = 2 THEN 4925
WHEN id = 3 THEN 1592
ELSE uid
END
WHERE id IN (1,2,3)
$postdata = http_build_query(
array(
'var1' => 'some content',
'var2' => 'doh'
)
);
$opts = array(
'http'=>array(
'method'=>"POST",
'header'=>"Accept-language: en\r\n" .
"Cookie: foo=bar\r\n" .
"User-agent: BROWSER-DESCRIPTION-HERE\r\n"
),
'content' => $postdata
);
$context = stream_context_create($opts);
$file = file_get_contents('http://www.example.com/', false, $context);
$curl_h = curl_init('http://www.example.com/');
curl_setopt($curl_h, CURLOPT_HTTPHEADER,
array(
'User-Agent: BROWSER-DESCRIPTION-HERE',
)
);
curl_setopt($curl_h, CURLOPT_POST, 1);
curl_setopt($resource, CURLOPT_POSTFIELDS, array('key' => '123213'));
curl_setopt($curl_h, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl_h);
// символы которые находится между id и user заменяем на символ *
preg_replace('/(?<=id)(.*?)(?=user))/is', '$1 * $3', $str)
$t_s = preg_replace('/^0(.*)/', '$1', $t_s);
$out= str_replace(":",".",$t_s);
$opts = array('http' =>
array(
'method' => 'GET',
'header' => array(
'Accept-Language: ru-Ru,ru;q=0.8',
'User-Agent: '.$_SERVER['HTTP_USER_AGENT'],
)
)
);
$context = stream_context_create($opts);
echo file_get_contents('https://sbonhelp.ru/registraciya-v-sberbank-online', false, $context);
echo "[";
while($hero2 = mysqli_fetch_assoc($hero1)){
$time_now = strtotime($hero2['cron1']);
$time_need = strtotime($hero2['cron2']);
if ($time_need>=$time_now ){
$t_s= date("H:i ",75600-($time_need-$time_now));
}
else {
$t_s= date("H:i ",75600-($time_now-$time_need));
}
echo str_replace(":",".",$t_s).",";
}
echo "]";