Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

How to specific character to start string to create array using php

by
Category:php
php
How to specific character to start string to create array using php

This code snippet shows you how to check if a string contains a specific character in PHP, or if a string contains a match from an array of word options. You may also like How to search in an array with preg_grep using php and Bootstrap search box.

Code

$Item = $_POST['item'];
$getitem =  nl2br($Item);
$haystack =  explode('<br />',$getitem);
$trimmed_array=array_map('trim',$haystack);

$EMS        = preg_grep ('/^E(\w+)/i', $trimmed_array);
$Parcel     = preg_grep ('/^C(\w+)/i', $trimmed_array);
$Registered = preg_grep ('/^R(\w+)/i', $trimmed_array);
$Traffic    = preg_grep ('/^T(\w+)/i', $trimmed_array);
$court      = preg_grep ('/^M(\w+)/i', $trimmed_array);

0 Comments


Html code work in comment box


Related Post