json_decode(file_get_contents('https://otvet.mail.ru/api/v2/questlist'), true)
<script type="text/javascript">document.write('<div class="b-post__price b-post__price_padleft_10 b-post__price_padbot_5 b-post__price_fontsize_15 b-post__price_bold b-post__price_float_right"> 150 000 р./месяц </div>');</script>
preg_match("<[^>]*script*\"?[^>]*>", $check_url)
//Загружаем файл или страницу, где есть нужный хэш
$text = file_get_contents('test.txt');
//Вырезаем хэш из переменной
preg_match('!md5_api_key = \'(.*?)\'!', $text, $result);
//Получаем именно строку с хэшем
$result = $result[1];
echo $result;
$page = file_get_contents('http://192.168.11.161');
preg_match_all('!(((\w+ )?\w+) \([A-Z%]\)): ([0-9.]+)!', $page, $matches);
$title = $matches[1];
$value = $matches[4];
$result = array_combine($title, $value);
echo '<pre>';
print_r($result);
echo '</pre>';
SELECT FROM_UNIXTIME(`date`, '%Y') as `year` FROM `data` GROUP BY YEAR(FROM_UNIXTIME(`date`, '%Y-%m-%d'))
preg_match_all('!(выражение){0, 5}!', $in, $out);
function modulename_get_product_display_by_product_id($product_id, $bundle = 'product', $field_name = 'field_producr') {
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node');
$query->propertyCondition('type', $bundle);
$query->fieldCondition($field_name, 'product_id', $product_id);
$query->range(0, 1);
$result = $query->execute();
if ($result) {
$product_display_nid = key($result['node']);
return node_load($product_display_nid);
}
}
/**
* Implements hook_init().
*/
function modulename_init() {
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'commerce_product')
->entityCondition('bundle', 'product')
->propertyCondition('status', 1)
->fieldOrderBy('commerce_price', 'amount', 'ASC')
;
$result = $query->execute();
$pids = array();
if (isset($result['commerce_product'])) {
$pids = array_keys($result['commerce_product']);
}
foreach($pids as $pid){
$sku = commerce_product_load($pid)->sku;
$node = modulename_get_product_display_by_product_id($pid);
$node->field_code_display[LANGUAGE_NONE][0]['value'] = $sku;
field_attach_update('node', $node);
}
}