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-17-2008, 04:24 AM   #1
ChargebackJoe
Confirmed User
 
Join Date: May 2006
Posts: 356
PhP Question

How come when I try
$htmlfile=sprintf("./html/%s%d.html",$name,$num);

it works fine but when I try to write $num as a string like so

$htmlfile=sprintf("./html/%s%s.html",$name,$num);

the resulting string gets partially overwritten. Is there a better way to do that? By the way I obtain $name and $num from 'list' of the out of 'explode' .
__________________
Buy PPC Traffic
ChargebackJoe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-17-2008, 04:29 AM   #2
rowan
Too lazy to set a custom title
 
Join Date: Mar 2002
Location: Australia
Posts: 17,393
If you want to make sure it's passed to sprintf as a string I think this should work:

$htmlfile=sprintf("./html/%s%s.html","$name","$num");
rowan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-17-2008, 04:36 AM   #3
ChargebackJoe
Confirmed User
 
Join Date: May 2006
Posts: 356
just tried it, still overwrites, thanks though

Quote:
Originally Posted by rowan View Post
If you want to make sure it's passed to sprintf as a string I think this should work:

$htmlfile=sprintf("./html/%s%s.html","$name","$num");
__________________
Buy PPC Traffic
ChargebackJoe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-17-2008, 06:03 AM   #4
Swish
Confirmed User
 
Swish's Avatar
 
Join Date: Mar 2006
Location: San Diego, CA
Posts: 1,421
You can just say:
Code:
$htmlfile = "./html/{$name}{$num}.html";
Easier
__________________


Naughty America - Director of Technology
It's a CELEBRATION bitches!! For the hottest content promote Naughty America!
swish at naughtyamerica dot com | ICQ: 226 737 620 | See Who I Am At AdultWhosWho.com!
Swish is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-17-2008, 09:28 AM   #5
maggie2007
Confirmed User
 
Industry Role:
Join Date: Jan 2007
Posts: 247
Swish, I think that { and } can be removed, right?
maggie2007 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-17-2008, 10:23 AM   #6
testpie
Mostly retired
 
testpie's Avatar
 
Industry Role:
Join Date: Apr 2006
Location: UK
Posts: 3,231
Quote:
Originally Posted by Swish View Post
You can just say:
Code:
$htmlfile = "./html/{$name}{$num}.html";
Easier
Isn't that the same as:
PHP Code:
$htmlfile "./html/".$name.$num.".html"
__________________

Affiliates: DogFart ~ Domain parking: NameDrive ~ Traffic broker: Traffic Holder
testpie is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-18-2008, 03:11 PM   #7
Swish
Confirmed User
 
Swish's Avatar
 
Join Date: Mar 2006
Location: San Diego, CA
Posts: 1,421
Quote:
Originally Posted by maggie2007 View Post
Swish, I think that { and } can be removed, right?
In this instance, yes.

Quote:
Originally Posted by testpie View Post
Isn't that the same as:
PHP Code:
$htmlfile "./html/".$name.$num.".html"
Yes.
__________________


Naughty America - Director of Technology
It's a CELEBRATION bitches!! For the hottest content promote Naughty America!
swish at naughtyamerica dot com | ICQ: 226 737 620 | See Who I Am At AdultWhosWho.com!
Swish 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.