|
|
|
||||
|
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() |
|
|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
|
Thread Tools |
|
|
#1 |
|
Confirmed User
Industry Role:
Join Date: Sep 2002
Location: San Francisco, California
Posts: 991
|
Any php gurus here? Array_walk help needed
Im trying to create a file by using each element of an array as the filename. I have the following code and am getting an Invalid argument error.
$newfile = file("newdata.txt"); function touchfile($foo) { touch($foo); } array_map ("touchfile", $newfile); The error is occurring in the touch line. Any suggestions are appreciated. Chris |
|
|
|
|
|
#2 |
|
Confirmed User
Industry Role:
Join Date: Jan 2002
Posts: 7,981
|
HAve you checled what newdata.txt contains?
|
|
|
|
|
|
#3 |
|
Confirmed User
Industry Role:
Join Date: Jan 2002
Posts: 7,981
|
edit....
|
|
|
|
|
|
#4 |
|
Confirmed User
Industry Role:
Join Date: Jan 2003
Location: In a Tater Patch
Posts: 2,321
|
sure your permissions are alright?
__________________
Managed Hosting - Colocation - Network Services Yellow Fiber Networks icq: 19876563 |
|
|
|
|
|
#5 | |
|
Confirmed User
Industry Role:
Join Date: Sep 2002
Location: San Francisco, California
Posts: 991
|
Quote:
ex. foo.html foo1.html |
|
|
|
|
|
|
#6 | |
|
Confirmed User
Industry Role:
Join Date: Sep 2002
Location: San Francisco, California
Posts: 991
|
Quote:
touch($foo); to touch('$foo'); it will create the file $foo |
|
|
|
|
|
|
#7 |
|
Confirmed User
Industry Role:
Join Date: Jan 2002
Posts: 7,981
|
This works:
Code:
<?php
$newfile = file("test.txt");
function touchfile($foo) {
$foo = trim($foo);
touch($foo);
}
array_walk($newfile, 'touchfile');
?>
|
|
|
|
|
|
#8 |
|
<&(©¿©)&>
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
|
what's the error you are getting?
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000 Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager ![]() Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager |
|
|
|
|
|
#9 |
|
Confirmed User
Industry Role:
Join Date: Sep 2002
Location: San Francisco, California
Posts: 991
|
Thanks swedguy. I guess there was a space/carriage return that was causing an error.
|
|
|
|
|
|
#10 |
|
Confirmed User
Industry Role:
Join Date: Jan 2002
Posts: 7,981
|
Hmm, just adding double quotes on the trim() in the original code works too. Odd.
|
|
|
|