is there any function that converts the values of an array to string?
i tried with array_values but i dont know how
janzaldo 0 Newbie Poster
Recommended Answers
Jump to PostFor a one dimensional array, use the implode() function:
$array = array('lastname', 'email', 'phone'); $comma_separated = implode(",", $array); echo $comma_separated; // lastname,email,phone
Jump to Postyezzz use PHP function implode()
Jump to PostImplode function does the trick for me. Here an example that I followed:
<?php
$array = array('lastname', 'email', 'phone');
$comma_separated = implode(",", $array);
echo $comma_separated; // lastname,email,phone
?>
All 12 Replies
samaru 145 a.k.a inscissor Team Colleague
ablitz -5 Light Poster
ShawnCplus commented: 6 Year bump to answered thread. Bummer -1
somedude3488 commented: Look at the damn date of the thread before posting. -1
nav33n commented: Being a member for such a long time, you should have known how bad it is to bump an old thread. -1
vaultdweller123 32 Posting Pro
nanosani 20 Technize.net addict Team Colleague
P0lT10n
ludohelder 0 Newbie Poster
jem215 0 Newbie Poster
lanclip 0 Newbie Poster
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
xShirowx -3 Newbie Poster
pritaeas commented: php.net/json_encode -3
mexican_75 0 Newbie Poster
mihai_daniel 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.