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.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-06-2005, 06:57 PM   #1
smashface
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
smashface is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2005, 07:01 PM   #2
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
HAve you checled what newdata.txt contains?
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2005, 07:02 PM   #3
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
edit....
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2005, 07:04 PM   #4
Spudstr
Confirmed User
 
Spudstr's Avatar
 
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
Spudstr is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2005, 07:11 PM   #5
smashface
Confirmed User
 
Industry Role:
Join Date: Sep 2002
Location: San Francisco, California
Posts: 991
Quote:
Originally Posted by swedguy
HAve you checled what newdata.txt contains?
it contains the text I want

ex. foo.html
foo1.html
smashface is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2005, 07:13 PM   #6
smashface
Confirmed User
 
Industry Role:
Join Date: Sep 2002
Location: San Francisco, California
Posts: 991
Quote:
Originally Posted by Spudstr
sure your permissions are alright?
Im testing on a Windows machine using Abyss Webserver plus PHP5. I'm able to get a literal value to be the filename. If I change;

touch($foo);

to

touch('$foo');

it will create the file $foo
smashface is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2005, 07:15 PM   #7
swedguy
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');
?>
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2005, 07:17 PM   #8
woj
<&(©¿©)&>
 
woj's Avatar
 
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
woj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2005, 07:21 PM   #9
smashface
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.
smashface is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-06-2005, 07:21 PM   #10
swedguy
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.
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.