delucaspinto

PHP array delete by value (not key)

Aug 11th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.37 KB | None | 0 0
  1. if (($key = array_search($produto->category, $categorias)) !== false) {
  2.     unset($categorias[$key]);
  3. }
  4.  
  5. <select name="category" class="form-control" required="">
  6.     <option value="{{$produto->category}}" selected>{{$produto->category}} <small>(atual)</small> </option>
  7.     @foreach($categorias as $cat)
  8.     <option value="{{$cat}}">{{$cat}}</option>
  9.     @endforeach
  10. </select>
Advertisement
Add Comment
Please, Sign In to add comment