Click here to Skip to main content
15,891,848 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I having array like this

$type = "LCDLEDREFRIGERATOR";

I want like this

$newtype = "LCD","LED","REFRIGERATOR";
Posted
Comments
CPallini 18-Aug-15 3:03am    
You have first to establish a way to recognize full words (e.g. store well-know complete words in an array).

1 solution

In php i believe you create arrays the following way:

PHP
$array = [
    "foo" => "bar",
    "bar" => "foo",
];

?>

So you would instead of typing:
PHP
$newtype = "LCD","LED","REFRIGERATOR";


Type this:
PHP
$newtype = array(
    "LCD",
    "LED",
    "REFRIGERATOR"
);


And the array should be accessible by doing for example:
PHP
$newtype[1];//Would give you the string "LED"
 
Share this answer
 
Comments
Yogesh1214 20-Aug-15 1:18am    
thanks that helped me!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900