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 8515097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:03:11+00:00 2026-06-11T05:03:11+00:00

I have function build_additional_docs which calls another function that do few actions, but first

  • 0

I have function build_additional_docs which calls another function that do few actions, but first it’s call to function read_all_file, which extract the file to string variable and return it.

It’s worked perfect when the function create_file_node has been called from another function.

but when it’s called from build_additional_docs, the client wait to server untill time out…
I think that the function fail on fgets().

Additional comment: When I call function create_file_node whith with the same files, and the different is that file name is static string, and I have no foreach loop, the code works again…

here is my code:

function build_additional_docs($dir_name, $addDocsArr){
foreach ($addDocsArr as $doc) {
    if($summery != ''){
        $fileName = $dir_name . '\\' . $doc;
        create_file_node($fileName);
    }
}


    function create_file_node($fileName){    global $base_url;
try{
        $text = read_all_file($fileName);
}
catch (Exception $ex){
     // some message here
}
return 0;
}

 function read_all_file($file_name){
$file_handle = fopen($file_name, "r");
while (!feof($file_handle)) {
   $line[] = fgets($file_handle);
}
fclose($file_handle);
return implode('',$line);
}
  • 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-11T05:03:13+00:00Added an answer on June 11, 2026 at 5:03 am

    Found the mistake!
    $addDocsArr variable is return value from explode() function for split string to seperated files names. The returned array include strings of file name with spacial characters that cannot be seen…
    so when i add the code:
    $fileName = $dir_name . '\\' . substr($doc, 0,strlen($doc) - 1);

    the code worked.

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

Sidebar

Related Questions

I have a variable that I'm using to build a JavaScript function call, and
this is so that I will have to build a delete function, I try
I'm trying to build a PHP function that allows me to have an array
I have a function that builds substrings given a string recursively. Could anyone please
I have a function that returns json (networks_function.php builds up some arrays and encodes
I have a PHP function that builds a JSON array via $jsonArray= array(); for
I have installation solution that have installer project (not web installer but simple installer)
I have some NUnit tests which uses a TestCaseSource function. Unfortunately, the TestCaseSource function
I have a template class which implements function: template<typename T> class Matrix { ...
I have the following code: function build_all_combinations(input_array){ array = [1,2,3] limit = array.length -

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.