Can we see liberary files where PHP readymade functions are declared.

Discussion in 'PHP' started by uid007, Dec 24, 2007.

  1. #1
    Hi all,

    i am using this code to write csv file.
    ================================================
    function csvwriter($filecontents=null){
    error_reporting(E_ALL ^ E_NOTICE);
    $arr = $_SERVER["SCRIPT_FILENAME"];
    $arr2 = explode("/",$arr);

    $fruit = array_pop($arr2);



    $path = implode("/",$arr2)."/";
    $fp = fopen($path.'logfile.csv','w');
    //pr($filecontents);
    foreach ($filecontents as $line) {
    fputcsv($fp,split(',',$line));
    }
    fclose($fp);
    return true;
    }//end function.
    =======================================================
    But i am getting this below error.However it is inbuild php function.Anybody can give me suggestion for it.

    Fatal error: Call to undefined function fputcsv() in /var/www/html/pnet/app/webroot/Autodownload/cronjob/lib.php on line 1008
     
    uid007, Dec 24, 2007 IP
  2. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #2
    Kaizoku, Dec 24, 2007 IP
  3. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Kaizoku is right. If you have to use the older version of PHP, follow the link that Kaizoku gave and check the first comment on the page: it has an implementation written in PHP for older versions.
     
    TwistMyArm, Dec 26, 2007 IP