PHP implode Invalid arguments passed

0 votes

I am using Codeigniter and its validation rules - a custom callback validation. I think this is not  CI-related. 

I've got this function to return a string :

function array_implode($a)
{
  return implode(',', $a);
}

But it always return a message, implode(): Invalid arguments passed

But var_dump() returns this:

array(2) {
  [0]=> string(10) "First item"
  [1]=> string(11) "Second item"
}

What am I doing wrong here? Can someone please help me with this?

Jun 13, 2022 in PHP by narikkadan
• 63,600 points
1,974 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
1 answer

Invalid argument supplied for foreach() on line 25. Error in my php and mysql

Hello @viven , This should be a simple fix ...READ MORE

answered Aug 4, 2020 in PHP by Niroj
• 82,840 points
4,340 views
0 votes
1 answer

How do you create optional arguments in php?

Hello @kartik, Use an equals (=) sign in ...READ MORE

answered Sep 17, 2020 in PHP by Niroj
• 82,840 points
2,428 views
0 votes
0 answers

How to run a PHP function due to a button click (with button 'data' passed)?

I manage some sortiment items on a ...READ MORE

May 28, 2022 in PHP by Kichu
• 19,040 points
3,987 views
0 votes
0 answers

PHP switch statement returns invalid output

The PHP switch statement returns invalid output : $cond ...READ MORE

Jun 9, 2022 in PHP by Kichu
• 19,040 points
358 views
0 votes
0 answers

PHP - CodeIgniter - Invalid argument supplied for foreach()

I'm attempting to use CodeIgniter to create ...READ MORE

Jul 25, 2022 in PHP by Kithuzzz
• 38,000 points
1,053 views
0 votes
1 answer

What are the vulnerability related to PHP Form?

Hii, The $_SERVER["PHP_SELF"] variable can be used by ...READ MORE

answered Feb 13, 2020 in PHP by Niroj
• 82,840 points
3,216 views
0 votes
1 answer

How to check if array is multidimensional or not?

Since the 'second dimension' could be just ...READ MORE

answered Nov 5, 2018 in Others by DataKing99
• 8,250 points
5,998 views
0 votes
1 answer

How to store input value into array then localstorage?

Hello @ abhittac, You have create the array everytime the ...READ MORE

answered Jul 24, 2020 in Java-Script by Niroj
• 82,840 points
9,197 views
0 votes
1 answer

Convert a PHP object to an associative array

Start with simply typecasting the line:- $array = ...READ MORE

answered Feb 23, 2022 in PHP by Aditya
• 7,680 points
2,103 views
0 votes
0 answers

php var_dump() vs print_r()

What is the difference between var_dump() and print_r() in terms of ...READ MORE

May 28, 2022 in PHP by Kichu
• 19,040 points
533 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP