snipt

Ctrl+h for KB shortcuts

PHP

delete all FALSE values ( NULL, empty, FALSE, ... ) from the specified array

<?php $new_array_without_nulls = array_filter($array_with_nulls); ?>
https://snipt.net/embed/4ac93696762e6faed845b96f6bfea497/
https://snipt.net/raw/4ac93696762e6faed845b96f6bfea497/
4ac93696762e6faed845b96f6bfea497
php
PHP
1
2016-09-22T16:57:50
True
False
False
/api/public/snipt/38064/
delete-all-false-values-null-empty-false-from-the-specified-array
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</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 class="nv">$new_array_without_nulls</span> <span class="o">=</span> <span class="nb">array_filter</span><span class="p">(</span><span class="nv">$array_with_nulls</span><span class="p">);</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
array, empty, null, php

JavaScript

select form set to empty

1
2
3
4
5
6
7
// This(id) form set to empty - (erasing all text)
function input_reset(id,default_param){
    var param_id = document.getElementById(id);
    if(param_id.value == default_param){
        param_id.value="";	
    }
}
https://snipt.net/embed/93a0d05bebba3454c7cdf0633efed8ba/
https://snipt.net/raw/93a0d05bebba3454c7cdf0633efed8ba/
93a0d05bebba3454c7cdf0633efed8ba
js
JavaScript
7
2016-09-24T10:56:51
True
False
False
/api/public/snipt/17912/
select-form-set-to-empty
<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 id="L-1"><a name="L-1"></a><span class="c1">// This(id) form set to empty - (erasing all text)</span> </span><span id="L-2"><a name="L-2"></a><span class="kd">function</span> <span class="nx">input_reset</span><span class="p">(</span><span class="nx">id</span><span class="p">,</span><span class="nx">default_param</span><span class="p">){</span> </span><span id="L-3"><a name="L-3"></a> <span class="kd">var</span> <span class="nx">param_id</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="nx">id</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">if</span><span class="p">(</span><span class="nx">param_id</span><span class="p">.</span><span class="nx">value</span> <span class="o">==</span> <span class="nx">default_param</span><span class="p">){</span> </span><span id="L-5"><a name="L-5"></a> <span class="nx">param_id</span><span class="p">.</span><span class="nx">value</span><span class="o">=</span><span class="s2">&quot;&quot;</span><span class="p">;</span> </span><span id="L-6"><a name="L-6"></a> <span class="p">}</span> </span><span id="L-7"><a name="L-7"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
empty, set

Text only

powershell delete empty directories

Get-ChildItem -recurse | Where {$_.PSIsContainer -and @(Get-ChildItem $_.Fullname -r | Where {!$_.PSIsContainer}).Length -eq 0} | Remove-Item -recurse
https://snipt.net/embed/6079209fc6faa073c2cac8f47514f1e0/
https://snipt.net/raw/6079209fc6faa073c2cac8f47514f1e0/
6079209fc6faa073c2cac8f47514f1e0
text
Text only
1
2016-09-24T22:30:53
True
False
False
/api/public/snipt/13954/
powershell-delete-empty-directories
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>Get-ChildItem -recurse | Where {$_.PSIsContainer -and @(Get-ChildItem $_.Fullname -r | Where {!$_.PSIsContainer}).Length -eq 0} | Remove-Item -recurse </span></pre></div> </td></tr></table>
directory, empty, powershell
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.