Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm trying to make a file system as a database and so far its all good put I have one problem.
I use:
function dfs_displayarray($input){
foreach($input as $whatever){
return $whatever;
}}
to display everything in array.
say that I have 1,2, and 3 in $arrayvar.
Well I want my function the one above to display everything in that array but the problem is when I use return it will only display 1 not 1,2, or 3. If I use echo it displays 1,2, and 3 but when I try to use the strstr function it don't work right.
Can someone please help me out with this?
Thanks
PhantomSonic-We are all born with a destiny.Some of us know it and some of us are still searching for it.

you are returning from the function after you displayed the first item of the array.
if you want to return the whole array, then
use
return $arrayvar;if you want to just display the array values
just using print
foreach($arr as $val){
print $val;
}
but put that outside your for loop.if you want to return just the first item
return $array[0];

Well I made one function that gets the file contents and puts them into an array.
I'm trying to make another function that reads the array and out puts everything in that array.
And I'm trying to use strstr function to find some text from the function
If I store the function contents in a var like this
"$var=displayarray()"
now $var contains everything that displayarray has. Also If I change return to echo in the display array it will display everything in the array but then the strstr don't work.
$var could contain "This is my function"
and I use strstr to find function it will com back false.
This is also really hard to explain.
Also I'm going to post my function source code so you can see what I'm taking about.
function dfs_list($table,$value,$event){
error_reporting(0);
require"connect.php";
$array1=array();
$path1="$ydatabase/$table";
$openpth=opendir($path1);
//print"$path1";
while($listdir1=readdir($openpth)){
$mike="$path1/$dot1$listdir1/$value.dfs";
$test=str_replace(".","","$path1/$dot1$listdir1/$value").".dfs";
//print"$test
";
$fopen=fopen($test,'r');
while($fileval=fread($fopen,filesize("$test"))){
array_push($array1,"$fileval");
}}
return $array1;
}
function dfs_displayarray($input){
foreach($input as $whatever){
return $whatever;
}}
To use it you would need to have$var=dfs_displayarray(dfs_list("Folder_that_the_files_are_in","Name_of_the_files",""));
also .dfs and dfs stands for Data for Sites
I really can't explain it any better then that so can someone please help me with this problem.Also for the ones that already made a post to try to help me out with this thanks I really appreciate it
PhantomSonic-We are all born with a destiny.Some of us know it and some of us are still searching for it.

the best way to describe your problem is to state down your specs. Provide sample inputs and describe desired output.

![]() |
java - parseInt
|
To change a sheet by usin...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |