<?php
require_once 'phpQuery-onefile.php';
$html = file_get_contents ('http://www.pesmaster.com/spanish-league/pes-2019/league/11/');
$pq = phpQuery::newDocument($html);
$cl = $pq->find("a.namelink[href*='team']");
foreach ($cl as $link)
{
$href[] = pq($link)->attr("href");
}
foreach ($href as $i)
{
echo $i;
echo "<br/>";
}
phpQuery::unloadDocuments($pq);
$res = array();
$res[] = array('name'=>4,'order_id' => 12);
$res[] = array('name'=>1,'order_id' => 12);
$res[] = array('name'=>1,'order_id' => 13);
$res[] = array('name'=>3,'order_id' => 13);
$prev = 0;
foreach ($res as $row) {
if ($prev <> $row['order_id'])
{
if ($prev > 0)
echo "конец ряда\n";
echo "начало ряда\n";
}
echo $row['name']."\n";
$prev = $row['order_id'];
}
if ($row['order_id'])
echo "конец ряда\n";
SELECT TOP 1 T.*
FROM (
SELECT T.word,
T.length
FROM (
SELECT TOP 1 *
FROM Table T
WHERE T.length >= 5
ORDER BY T.length
) T
UNION ALL
SELECT T.word,
T.length
FROM (
SELECT TOP 1 *
FROM Table T
WHERE T.length <= 5
ORDER BY T.length DESC
) T
) T
ORDER BY T.length
<?php
# запуск импорта
if (file_exists('www/xxx.xxx/process.sig')){
unlink('www/xxx.xxx/process.sig');
exec('/opt/php53/bin/php process.php');
}
<?php
include 'simple_html_dom.php';
$site = 'http://optnow.ru/catalog';
$data = file_get_html($site);
$catalogLink = array();
if(!empty($data)) {
foreach($data->find('div.cat-name a') as $catalog) {
$catalogLink['url'] = $catalog->href;
$urls[] = $catalogLink;
}
foreach($urls as $url => $k) {
foreach($k as $n) {
$catalogLink = 'http://optnow.ru/' . $n . '?page=0';
$productData = file_get_html($catalogLink);
// смотрим отсюда
foreach($productData->find('.link-pv-name') as $link) {
$productLink['url'] = $link->href;
$productUrls[] = $productLink;
}
}
}
}
if (1=1 && 2=2):
// если первое и второе условие истина
endif;
if (5=4 || 5>4):
// если первое ИЛИ второе условие истина
endif;
if (1=1 || 1=1 || 1=1 || 1=1 || 1=1):
// если какое либо из условий истина
endif;
<?php
$facebook = $header_setting['social_media_facebook_link'];
$twitter = $header_setting['social_media_twitter_link'];
$linkdin = $header_setting['social_media_linkedin_link'];
$social = '<ul id="%1$s" class="%2$s">%3$s';
if($header_setting['header_social_media_enabled'] == 0 )
{
$social .= '<ul class="head-contact-social">';
if($header_setting['social_media_facebook_link'] != '') {
$social .= '<li class="facebook"><a href="'.$facebook.'"';
if($header_setting['facebook_media_enabled']==1)
{
$social .= 'target="_blank"';
}
$social .='><i class="fa fa-facebook"></i></a></li>';
}
if($header_setting['social_media_twitter_link']!='') {
$social .= '<li class="twitter"><a href="'.$twitter.'"';
if($header_setting['twitter_media_enabled']==1)
{
$social .= 'target="_blank"';
}
$social .='><i class="fa fa-twitter"></i></a></li>';
}
if($header_setting['social_media_linkedin_link']!='') {
$social .= '<li class="linkedin"><a href="'.$linkdin.'"';
if($header_setting['linkedin_media_enabled']==1)
{
$social .= 'target="_blank"';
}
$social .='><i class="fa fa-linkedin"></i></a></li>';
}
$social .='</ul>';
}
$social .='</ul>';
?>
<?php
function mysort($a, $b)
{
if ($a['tk'] == $b['tk']) {
return 0;
}
return ($a['tk'] < $b['tk']) ? -1 : 1;
}
$orders_data = array();
$orders_data[] = array('tk'=>'z','region'=>4,'name'=>9);
$orders_data[] = array('tk'=>'s','region'=>2,'name'=>20);
$orders_data[] = array('tk'=>'t','region'=>3,'name'=>10);
$orders_data[] = array('tk'=>'a','region'=>1,'name'=>2);
usort($orders_data, "mysort");
print_r($orders_data);
?>