snipt

Ctrl+h for KB shortcuts

Text only

Get day of the week

1
2
3
4
5
6
7
echo date('Y-m-d',time()+( 1 - date('w'))*24*3600);

For next week:

echo date('Y-m-d',time()+( 8 - date('w'))*24*3600);

1 for Monday, 2 Tuesday, 3 Wednesday and so on. Have a try.
https://snipt.net/embed/93a8b017d2cbb5952f16de0e718dd1fd/
/raw/93a8b017d2cbb5952f16de0e718dd1fd/
93a8b017d2cbb5952f16de0e718dd1fd
text
Text only
8
2019-07-22T07:14:56
True
False
False
/api/public/snipt/42963/
get-day-of-the-week
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>echo date(&#39;Y-m-d&#39;,time()+( 1 - date(&#39;w&#39;))*24*3600); </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>For next week: </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>echo date(&#39;Y-m-d&#39;,time()+( 8 - date(&#39;w&#39;))*24*3600); </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a>1 for Monday, 2 Tuesday, 3 Wednesday and so on. Have a try. </span></pre></div> </td></tr></table>
Php

Text only

XML parse from file

1
2
3
4
5
6
$url = 'http://vrijeme.hr/hrvatska_n.xml';


$xml = simplexml_load_file($url);

print_r($xml);
https://snipt.net/embed/348fce47a81a31aa08a8ce3a84aec49b/
/raw/348fce47a81a31aa08a8ce3a84aec49b/
348fce47a81a31aa08a8ce3a84aec49b
text
Text only
6
2019-07-12T04:03:40
True
False
False
/api/public/snipt/42578/
xml-parse-from-file
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>$url = &#39;http://vrijeme.hr/hrvatska_n.xml&#39;; </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>$xml = simplexml_load_file($url); </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>print_r($xml); </span></pre></div> </td></tr></table>
Php