Questions tagged [implode]

implode() is a PHP function that joins together an array (optionally based on a 'glue' (inverse delimiter)) and returning a string.

implode() is a PHP function that joins together an array (optionally based on a 'glue' (inverse delimiter - defaults to an empty string) and returning a string.

string implode ( string $glue , array $pieces )
string implode ( array $pieces )

Example

$array = array("a", "b", "c", "d");
print_r(implode(" ", $array));
print_r(implode($array));

returns:

a b c d
abcd
749 questions
2
votes
2 answers

How to create PHP Array from Mysql

I am trying to create an array from a MySQL query that I have. This is to update facebook status' with the access tokens I have stored in my MySQL database. I am able to pull the access tokens without problem, but am having trouble creating an array…
phil
  • 21
  • 1
2
votes
2 answers

PHP Problems Combining implode() with mysql_real_escape_string()

How do I correctly write the code for a MySQL query that both implodes and mysql_real_escape_string? This is the code that I have, but it's failing: $sql = "INSERT INTO BEER_LOCATIONS (LOCATION_NAME, LOCATION_STREET, LOCATION_CITY,…
Mark
  • 31
  • 1
  • 4
2
votes
1 answer

Formatting php echo with null values

Let's say I have a php array called $t with 5 elements in it. For demonstration purposes, let's call it $t = [a,b,c,d,e]. I want to echo all elements in parenthesis like this: (a, b, c, d, e). However, I want this parenthesis format to hold if there…
Programmer
  • 1,266
  • 5
  • 23
  • 44
2
votes
1 answer

explode/implode array in PHP

Not sure why I am having this problem. I have used this same code on a previous project with no problems. I'm generating an array using checkboxes in JavaScript. I can successfully $.post the array to PHP, but I keep receiving the following…
John Beasley
  • 2,577
  • 9
  • 43
  • 89
2
votes
2 answers

PHP Implode Value

How can I get a single value from the array below? The current result for the 19th row is like 19 repeated twice as; E:/database/users/1919/ I just need the 19, so the URL will look like; E:/database/users/19/
haZh
  • 127
  • 2
  • 12
2
votes
1 answer

php htmlentities on only!

I want to run htmlentities() only on the contents within things to strip I Wrote a function that takes a string and finds the content in between function parse_code($string) { // test the string and…
kr1zmo
  • 837
  • 3
  • 13
  • 30
2
votes
1 answer

Imploding specific associative array key values

I've got associative array with results from database containing data like in following structure: $arr[0] = Array("id"=>4, "otherdata"=>"something"); $arr[1] = Array("id"=>6, "otherdata"=>"something else"); $arr[2] = Array("id"=>15,…
DevilaN
  • 1,317
  • 10
  • 21
2
votes
1 answer

is it possible to select from a combination of IDs from one column n display each IDs name?

Well its kind of complicated to describe what i am trying to do, let me explain completely. first of all i have selected one or more than one option from multiple selection and implode it into a column, now i want display each selections IDs name in…
Iam Srkfan
  • 197
  • 9
2
votes
3 answers

Restructure array to join elements from 3rd position to end of array and store as 3rd element

I have arrays like this: Array( [0] => 85 [1] => 85167920 [2] => ELECTRICAL/ELECTRONIC [3] => DEVICES [4] => FOR [5] => REPELLING [6] => INSECTS [7] => (E.G.MOSQUITOES [8] => ETC) ) and Array( [0] => 85 [1]…
Boyka
  • 143
  • 2
  • 13
2
votes
1 answer

Join 2 echoes and separate with coma - implode, array

I've got 2 variables. First is coming from the taxonomy and outputs the taxonomy term and the second outputs the custom field: $address_city = get_custom_field( 'address_city' ); echo '' . $address_city . ''; $terms =…
Joe Bloggs
  • 1,410
  • 2
  • 24
  • 53
2
votes
4 answers

multidimensional array value as implode value

I am facing some problem to fix this issue. My array same as below Array ( [0] => Array ( [coupon] => dasd ) [1] => Array ( [coupon] => aaa ) ) From here I want to display only coupon value as comma separated. Same as below dasd,aaa To solve this…
Lemon Kazi
  • 3,308
  • 2
  • 37
  • 67
2
votes
4 answers

How to create SPF record for many IPs (SPF longer than 255 characters)

For example I have an array with this ips and want to create with my code an long spf record: $array_ips = array(); $array_ips[] = "32.16.8.133"; $array_ips[] = "32.16.4.247"; $array_ips[] = "35.16.8.184"; $array_ips[] = "32.16.8.127"; $array_ips[]…
Mann87
  • 314
  • 1
  • 4
  • 14
2
votes
1 answer

Post name with array by clone

I want to post to file crud.php, but it form create by jquery clone that produce name with array in array. Please see snippet ! $(document).ready(function() { addBarang(); }); function addBarang() { var new_barang =…
wawan Setiyawan
  • 371
  • 7
  • 21
2
votes
4 answers

bash implode array (to string)

i know in stackoverflow are some examples but they doesn't work as i need it, example: separator=")|(" foo=('foo bar' 'foo baz' 'bar baz') regex="${foo[@]/#/$separator}" regex="${regex:${#separator}}" # remove leading separator echo…
Radek
  • 469
  • 4
  • 8
2
votes
2 answers

IMPLODE data by checkbox

i have this Interface where the user can add a flower The user need to add a flower to the database and he can make them in different occasions a categories (the check boxes). Now to implode the data i made this code: $occasions = implode( ';' ,…
Sigmond Gatt
  • 73
  • 10