Note that there are some explanatory texts on larger screens.

plurals
  1. PORemove item from php loop
    primarykey
    data
    text
    <p>I have a loop which index files if folder named "data" and show all files as loop. In extra it checks for url string and if there is subfolder (data/folderrandom) described in string "d" (index.php?d=folderrandom) then it shows files of that sub-folder!</p> <p>I want to slice out two files named "downloadHTML" and "downloadPHP" which are stored in "data" folder from the loop. I would like to slice the item contain above file name! Some part of loop code is as below</p> <pre><code>if(count($files) &gt;= 1){ foreach ($files as $file) { $nb++; if (!is_dir($file)) { ?&gt; &lt;div class="tab icon"&gt;hi &lt;?php if($folders){ ?&gt; &lt;a href="index.php?p=view&amp;f=&lt;?php echo $nb; ?&gt;&amp;d=&lt;?php echo $folders; ?&gt;"&gt; &lt;?php }else{ ?&gt; &lt;a href="index.php?p=view&amp;f=&lt;?php echo $nb; ?&gt;"&gt; &lt;?php } $info = preg_replace("/\\.[^.\\s]{3,4}$/", "", $file); echo basename($info); $blocks[$nb] = $file; ?&gt; &lt;/a&gt; &lt;/div&gt; &lt;?php }else{ $file_name = basename($file); ?&gt; </code></pre> <p>The below php code slice item from left and right what you like. Its very useful, and can help to get answer.</p> <pre><code>&lt;? function arem($array,$value){ $holding=array(); foreach($array as $k =&gt; $v){ if($value!=$v){ $holding[$k]=$v; } } return $holding; } function akrem($array,$key){ $holding=array(); foreach($array as $k =&gt; $v){ if($key!=$k){ $holding[$k]=$v; } } return $holding; } $lunch = array('sandwich' =&gt; 'cheese', 'cookie'=&gt;'oatmeal','drink' =&gt; 'tea','fruit' =&gt; 'apple'); echo '&lt;pre&gt;'; print_r($lunch); $lunch=arem($lunch,'apple'); print_r($lunch); $lunch=akrem($lunch,'sandwich'); print_r($lunch); echo '&lt;/pre&gt;'; ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload