• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

In PHP, which is faster: preg_split or explode?

phpexplodepreg-split


PHP Snippet 1:

$keyword = explode(' ', $_GET['search']); //or preg_split
print_r($keyword);

$keyword = array_filter($arr, 'empty');
print_r($keyword);

Related Snippets

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

onKeyUp event calculation not working on the following rows from php generated forms except the first one

Magento Installation SQLSTATE[HY000] [2002] No such file or directory error

Symfony - EasyAdmin - Add and remove functions are ignored from AssociationField

Load a .env file with PHP

Spam Filter in Contact Form

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

MongoDB Duplicate Documents even after adding unique key

Maatwebsite Excel 3.1 : how do I skip duplicate data when imported?

Laravel Carbon throws error The format separator does not match

How to update array value in Laravel

Edit XML in HTML form and submit to self

Last order would be re-order in wooCommerce. How is it possible?

Group rows by column and sum another column within groups [duplicate]

Destroy session upon refresh

About Contact Privacy policy Terms and conditions