Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8512417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:16:29+00:00 2026-06-11T04:16:29+00:00

I don’t know what I have done wrong with the code below but it

  • 0

I don’t know what I have done wrong with the code below but it is not working.

if($_data_count = count($_csv_raw_array) > 0){
            foreach($_csv_raw_array as $_csv_row){
                array_push($this->_data, array_map(call_user_func(array($this, 'replace')), $_csv_row));
            }
            return $this->result(true, 'CSV parsing done.', '', $this->_data);
        }

// And the replace function is:

    private function replace($_value){
    return preg_match('/(\r\n|\n|\r)/', $_value) ? '' : $_value;
}

But I don’t know why it is not working and throws an exception:

A PHP Error was encountered

Severity: Warning

Message: Missing argument 1 for Import::replace()

Filename: libraries/Import.php

Line Number: 116

Basically what I wanted to to here is import a CSV file which I already imported, now I want to replace any new line characters that is present within the array to be replaced with empty (nothing). But every time I execute this code it throws an exception. Can you people out there suggest. Please.

Thanx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:16:30+00:00Added an answer on June 11, 2026 at 4:16 am

    As pointed out in the comments, judging by your code you will want to drop that call_user_func, since that is causing the function to be called immediately and that does not seem to be what you want, which I presume is to filter out all the elements within $_csv_row in each iteration:

    if($_data_count = count($_csv_raw_array) > 0){
        foreach($_csv_raw_array as $_csv_row){
            array_push($this->_data, array_map(array($this, 'replace'), $_csv_row));
        }
        return $this->result(true, 'CSV parsing done.', '', $this->_data);
    }
    

    We can only guess what is your intention though, you might want to provide a sample csv and the desired output so we can understand more precisely what you are looking for if this doesn’t solve the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

don't know better title for this, but here's my code. I have class user
Don't know why but font is not displaying.Please help. CSS(in css folder): style.css: @font-face
I don't know why, but this code worked for me a month ago... maybe
I don't know if this question is trivial or not. But after a couple
Don't know why, but sometimes LocationManager is still working also after closing application. I
Don't know if I'm over-thinking this or not.. but I'm trying to be able
Don't know why but I can't find a solution to this. I have 3
Don't know how to frase this but I found this code wich works as
don't know if the title describes anything about what I'm trying to say but
Don't ask me how but I'm in a situation where I have DCPs published

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.