snipt

Ctrl+h for KB shortcuts

PHP

Recoger variables

1
2
3
4
5
6
7
8
<?php
//recoge las variables por post y las introduce en variables con el
//mismo nombre con el que pasan

foreach ($_POST AS $var => $value) {
	$arBusqueda[$var] = $value;
}
?>
https://snipt.net/embed/cf6cab6bf76df811ba31c1bc98d80338/
https://snipt.net/raw/cf6cab6bf76df811ba31c1bc98d80338/
cf6cab6bf76df811ba31c1bc98d80338
php
PHP
8
2016-09-22T15:22:28
True
False
False
/api/public/snipt/4120/
recoger-variables
<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> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">//recoge las variables por post y las introduce en variables con el</span> </span><span id="L-3"><a name="L-3"></a><span class="c1">//mismo nombre con el que pasan</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="k">foreach</span> <span class="p">(</span><span class="nv">$_POST</span> <span class="k">AS</span> <span class="nv">$var</span> <span class="o">=&gt;</span> <span class="nv">$value</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-6"><a name="L-6"></a> <span class="nv">$arBusqueda</span><span class="p">[</span><span class="nv">$var</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$value</span><span class="p">;</span> </span><span id="L-7"><a name="L-7"></a><span class="p">}</span> </span><span id="L-8"><a name="L-8"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
foreach, get, php, post, var, variables

Java

Java ForEach Loop

1
2
3
for(ObjectName object: objectList) {
   // Code Here
}
https://snipt.net/embed/6e40439d3cc5e9b4e6055ff736433bc3/
https://snipt.net/raw/6e40439d3cc5e9b4e6055ff736433bc3/
6e40439d3cc5e9b4e6055ff736433bc3
java
Java
3
2016-09-29T00:59:07
True
False
False
/api/public/snipt/891/
java-foreach-loop
<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></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="k">for</span><span class="o">(</span><span class="n">ObjectName</span> <span class="n">object</span><span class="o">:</span> <span class="n">objectList</span><span class="o">)</span> <span class="o">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="c1">// Code Here</span> </span><span id="L-3"><a name="L-3"></a><span class="o">}</span> </span></pre></div> </td></tr></table>
foreach, java, loop
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.