Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php how to split square bracket and normal sting in a word or sentence

<?php
$format = PREG_SPLIT_DELIM_CAPTURE;
$text = "[cat]myString ";
$keywords = preg_split("/([[^]]+])/", $text, -1, $format);
print_r($keywords);
echo "<br/>";
echo "First= ".$keywords[0]; output => blank 
echo "<br/>";
echo "Second= ".$keywords[1]; output => [cat]
echo "<br/>";
echo "Third= ".$keywords[2]; output => myString
?>
Comment

PREVIOUS NEXT
Code Example
Php :: Metabox Array 
Php :: laravel like 
Php :: Comment supprimer les onglets WooCommerce dans WordPress 
Php :: check backend post type 
Php :: X-Frame-Options may only be set via an HTTP header sent along with a document. It may not be set inside <meta. 
Php :: adding field to array on condition laravel 
Php :: keep value after submit php 
Php :: laravel add model to one to many relationship 
Php :: Code of getting sum of digits 
Php :: php calculate variance 
Php :: laravel validation on gropu route 
Php :: Print all before characters once string found | matched string return 
Php :: Writing into the database with one click laravel 
Php :: laravel helper.php session data 
Php :: Expression #1 of ORDER BY contains aggregate function and applies to the result of a non-aggregated query laravel 
Php :: FT_USER 
Php :: xampp pdoexception could not find driver 
Php :: docker commant 
Php :: eager load relationships on an existing model in route laravel 
Php :: datetime-local laravel migration data type 
Php :: .phtml 
Php :: Yii::$app-session 
Php :: how to find number between different ranges in php 
Php :: flexslider in laravel 5.8 
Php :: how to fetch data from database in php and display in pdf 
Php :: Laravel function to check if image exist or not 
Php :: Custom searchform 
Php :: echo define value 
Php :: x-default wpml canonical alternate hreflang 
Php :: Laravel Read multiple file extensions 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =