php explode
$colors = "red,blue,green,orange";
$colorsArray = explode(",", $colors);
php explode
$colors = "red,blue,green,orange";
$colorsArray = explode(",", $colors);
mysql split string
CREATE FUNCTION `SPLIT_STRING`(
str VARCHAR(255) ,
delim VARCHAR(12) ,
pos INT
) RETURNS VARCHAR(255) CHARSET utf8 RETURN REPLACE(
SUBSTRING(
SUBSTRING_INDEX(str , delim , pos) ,
CHAR_LENGTH(
SUBSTRING_INDEX(str , delim , pos - 1)
) + 1
) ,
delim ,
''
);
SELECT
-- keyword 1
SPLIT_STRING(`keywords`,',',1) AS keyword_1,
-- keyword 4, NOT trimmed
SPLIT_STRING(`keywords`,',',4) AS keyword_4,
-- keyword 4, trimmed
trim(SPLIT_STRING(`keywords`,',',4)) AS keyword_4_trimmed
FROM `test`;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us