public/rest_api/update?id=4&...
$id = $request->request->get('id');
$id = $request->query->get('id');
$element = '<a href="' . $href . '">' . $includes . '</a>';
в переменной $includes у вас DOMNodeList, который "could not be converted to string"$newElement = $dom->createTextNode('<a href="' . $href . '"></a>');
$element->parentNode->replaceChild($newElement, $element);
$unitOfWork = $entityManager->getUnitOfWork();
$unitOfWork->computeChangeSets();
$changesets = $unitOfWork->getEntityChangeSet($article);
<?php namespace MyProject { const CONNECT_OK = 1; class Connection { /* ... */ } function connect() { /* ... */ } } namespace { // глобальный код session_start(); $a = MyProject\connect(); echo MyProject\Connection::start(); } ?>
$array = [
'avto' => [
[
'marka' => 'Opel',
'model' => 'Kaded',
],
[
'marka' => 'BMW',
'model' => '520',
]
],
'kontakt' => [
[
'tel' => '+7(908) 457-40-22',
'mail' => 'art45@mail.ru',
],
[
'tel' => '+7(908) 455-10-02',
'mail' => 'student15@gmail.ru',
]
]
];
$array['avto'] = array_combine(array_column($array['kontakt'], 'mail'), $array['avto']);
print_r($array);
$string = <<<XML
<offers>
<offer id="1" available="true">
<url>
http://localhost.com/
</url>
<name>Название</name>
<picture>
http://localhost.com/pic1.png
</picture>
<picture>
http://localhost.com/pic2.png
</picture>
</offer>
<offer id="2" available="true">
<url>
http://localhost.com/
</url>
<name>Название</name>
<picture>
http://localhost.com/pic3.png
</picture>
<picture>
http://localhost.com/pic4.png
</picture>
<picture>
http://localhost.com/pic5.png
</picture>
</offer>
</offers>
XML;
$dom = new DOMDocument();
$dom->loadXML($string);
$domXpath = new DOMXpath($dom);
for ($i = 0; $i < $dom->getElementsByTagName('offer')->length; $i++) {
$xpath = sprintf('//offer[%d]/picture', $i + 1);
$pics = [];
$pictures = $domXpath->query($xpath);
foreach ($pictures as $k => $picture) {
$pics[] = trim($picture->nodeValue);
if ($k > 0) {
$picture->parentNode->removeChild($picture);
}
}
if ($pictures->length > 0) {
$pictures->item(0)->nodeValue = implode(' | ', $pics);
}
}
echo $dom->saveXML();
// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://forklog.com/wp-content/themes/newForklog/ajaxposts.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "action=PostsByCat&offset=12&postperpage=12&category=news/&tag=news/");
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array();
$headers[] = "Referer: https://forklog.com/news/";
$headers[] = "Content-Type: application/x-www-form-urlencoded; charset=UTF-8";
$headers[] = "X-Requested-With: XMLHttpRequest";
$headers[] = "Connection: keep-alive";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
$likess = intval($likes);
$arr_likes = explode(",", $likess);
$.ajax({
method: "post",
url: "main.php?",
data: data
});
$("#submit").onclick(function()
if(true) {...
$nodes = $root->childNodes;
$nodes = $root->getElementsByTagName('*');
В таблице MySQL есть поле recdate типа DATE.
{{ tran.recdater }}
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Ost\BlogBundle\Services\Naming;
class TestController extends Controller
{
public function key(Naming $naming)
{
}
}
<?php $arr = range(1, 50); ?>
<table border="1">
<?php for ($k = 0; $k < count($arr); $k++): ?>
<tr>
<?php for ($i = 0; $i < count($arr); $i++): ?>
<td><?php echo ($i - 1 === $k || $i === 0) ? '+' : '' ?></td>
<?php endfor; ?>
</tr>
<?php endfor; ?>
</table>