Transferreing array values out of a function into another array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tek9_AK

    Transferreing array values out of a function into another array

    I need to find a way to transfer all the values of an array inside a
    function out of the fuction into another array. IE

    function splice($filenam e){
    if(file_exists( $filename)){
    $value=array("0 "); // clear the array.
    $rows=file($fil ename); // break text file into a rows array
    for($num=0;$num < count($rows); ++$num){
    $column=split(" ;",$rows[$num]);
    $value[$num]=$column;}}
    return $value;
    }

    $array1 = splice(file.txt )


    Example file data would be

    data1;an1;bc1
    data2;an2;bc2
    data3;an3;bc3

    How do I go about getting the function to pass all it's data to the variable
    $array1?
    Thanks in advance.



  • Reply Via Newsgroup

    #2
    Re: Transferreing array values out of a function into another array

    Tek9_AK wrote:
    [color=blue]
    > I need to find a way to transfer all the values of an array inside a
    > function out of the fuction into another array. IE
    >
    > function splice($filenam e){
    > if(file_exists( $filename)){
    > $value=array("0 "); // clear the array.
    > $rows=file($fil ename); // break text file into a rows array
    > for($num=0;$num < count($rows); ++$num){
    > $column=split(" ;",$rows[$num]);
    > $value[$num]=$column;}}
    > return $value;
    > }
    >
    > $array1 = splice(file.txt )
    >
    >
    > Example file data would be
    >
    > data1;an1;bc1
    > data2;an2;bc2
    > data3;an3;bc3
    >
    > How do I go about getting the function to pass all it's data to the variable
    > $array1?
    > Thanks in advance.
    >
    >
    >[/color]


    You've made this same post/question twice - Check the more recent post
    that I've replied to...

    randelld

    Comment

    Working...