Re: [PHP] String format problem

2005-09-01 Thread Mark Rees
In fact, this is a poor example since the difference gets larger with longer string and more arguments. When you use dots, the interpreter has to actually concatenate the string, looking for memory to do so and freeing it up afterwards. This takes time. With commas, each argument is sent to

[PHP] array merge problem

2005-09-01 Thread Ahmed Abdel-Aliem
i have the array with the following structure : Array ( [19] = 20.00 [25] = 20.00 [7] = 30.00 [17] = 30.00 ) when i merge a field to it using array_merge it returns that : Array ( [0] = 20.00 [1] = 20.00 [2] = 30.00 [3] = 30.00 [4] = 200.00 ) how can i merge

Re: [PHP] ID based on position?

2005-09-01 Thread Mark Rees
Auugh!! Why would you want to do this? You're flying in the face of relational database theory and practice. Position of a record in the table is, or should be irrelevant. Agreed - position is a notional concept. The data is stored physically in some sort of order, but what order that is is

[PHP] fread and fgets (network streams)

2005-09-01 Thread The Gimper
On the php.net you can read the following about fread: fread() reads up to length bytes from the file pointer referenced by handle. Reading stops when length bytes have been read, EOF (end of file) is reached, or (for network streams) when a packet becomes available, whichever comes first. Is

RE: [PHP] array merge problem

2005-09-01 Thread Shaw, Chris - Accenture
manual snippets If you want to completely preserve the arrays and just want to append them to each other, use the + operator. ?php $array1 = array(); $array2 = array(1 = data); $result = $array1 + $array2; ? The numeric key will be preserved and thus the association remains. Array ( [1] =

[PHP] Saturdays and Sundays

2005-09-01 Thread Shaun
Hi, Is it possible to get the number of saturdays and sundays for a given month / year? Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] String format problem

2005-09-01 Thread Ford, Mike
On 31 August 2005 16:56, [EMAIL PROTECTED] wrote: $varname = '$firstname $lastname told me to find the file in folder C:\newtext\'; echo $varname; Yields.. $firstname $lastname told me to find the file in folder C:\newtext\ Actually, that'll give you an error as well, since \' is also

[PHP] Help: Get the value of pi up to 200+ digits?

2005-09-01 Thread Wong HoWang
Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? Can anyone help? Thx! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Help: Get the value of pi up to 200+ digits?

2005-09-01 Thread Wong HoWang
Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? Can anyone help? Thx! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Help: Get the value of pi up to 200+ digits?

2005-09-01 Thread Torgny Bjers
Wong HoWang wrote: Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? I am fairly sure that you have to use BCMath for this: http://www.php.net/manual/en/ref.bc.php Give it a go and see what happens! :)

Re: [PHP] Help: Get the value of pi up to 200+ digits?

2005-09-01 Thread Wong HoWang
but my server configure don't have bcmath enabled, is there any other way to do so? Torgny Bjers [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] Wong HoWang wrote: Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ?

Re: [PHP] Help: Get the value of pi up to 200+ digits?

2005-09-01 Thread Oliver Grätz
Wong HoWang schrieb: but my server configure don't have bcmath enabled, is there any other way to do so? Since the internal routines of PHP have limited precision, you these options: - Find a way to activate bcmath (not likely to happen on a shared hosting account) - Find an external program

[PHP] Re: Computers name?

2005-09-01 Thread Oliver Grätz
Gustav Wiberg schrieb: Hi there! Is it possible to get (retrieve) the computername of the client? I just want the name for comparing... In PHP all you get from the client is in the predefines variables: http://de.php.net/manual/en/language.variables.predefined.php Perhaps these are of any

[PHP] Re: Computers name?

2005-09-01 Thread Oliver Grätz
Gustav Wiberg schrieb: Hi there! Is it possible to get (retrieve) the computername of the client? I just want the name for comparing... In PHP all you get from the client is in the predefines variables: http://de.php.net/manual/en/language.variables.predefined.php Perhaps these are of any

Re: [PHP] String format problem

2005-09-01 Thread tg-php
Wow! Fantastic rundown Satyam! Thanks for posting such a complete analysis. I had no idea that you could use commas instead of periods to join multiple strings much less do it without concatinating, that's very interesting. I don't think I've ever seen that used in any sample code before.

RE: [PHP] Saturdays and Sundays

2005-09-01 Thread Murray @ PlanetThoughtful
Hi, Is it possible to get the number of saturdays and sundays for a given month / year? Thanks for your help. Hi Shaun, Not sure if there's a graceful PHP solution (there probably is, but can't think of one, myself, right at this moment) but it sounds like what you might need is a

Re: [PHP] Help: Get the value of pi up to 200+ digits?

2005-09-01 Thread Jordan Miller
http://us3.php.net/manual/en/ini.core.php#ini.precision precision sets the number of significant digits, *NOT* the number of digits displayed after the decimal point. If you want to get pi out to 16 decimal places you need a precision of *17* because the beginning 3 is a significant digit.

Re: [PHP] Help: Get the value of pi up to 200+ digits?

2005-09-01 Thread Wong HoWang
Dear Jordan, I know what you mean. But you may try this one and you will know: ?php ini_set('precision',200); echo pi(); ? the result is the same as 16!!! So that's why I ask this question! I am not stupid like that! Please help, thx! Jordan Miller [EMAIL PROTECTED] wrote:[EMAIL PROTECTED]

[PHP] Re: Saturdays and Sundays

2005-09-01 Thread Wong HoWang
the answer is simply yes! You can have a simple for looping to do so. ?php // for example, 02/2005 $year = 2005; $month = 02; for ($i = 1; $i = 31 ; $i++) { if (checkdate($month,$i,$year)) { if (date(w,mktime(0,0,0,$month,$i,$year)) == '0') // it is Sunday echo $i . '/' . $month . '/' .

[PHP] Re: Saturdays and Sundays

2005-09-01 Thread M. Sokolewicz
since only the total number of saturdays/sundays is what he wants to know, you can use some clever math. Basically, the amount of saturdays in a year is: floor(365 (+1 if it's a leap year) (-days from january first to first saturday) / 7); and sundays = saturdays (-1 if the modulo from the top

Re: [PHP] Saturdays and Sundays

2005-09-01 Thread Philip Hallstrom
Is it possible to get the number of saturdays and sundays for a given month / year? This seems to work... ?php $month = 9; $year = 2005; $day = 1; $ts = mktime(0, 0, 0, $month, $day, $year); $week_day = date(w, $ts); // 0 (for Sunday) through 6 (for Saturday) if ( $week_day 0 $week_day

[PHP] Re: array merge problem

2005-09-01 Thread JamesBenson
could this help If you want to completely preserve the arrays and just want to append them to each other, use the + operator: ?php $array1 = array(); $array2 = array(1 = data); $result = $array1 + $array2; ? http://www.php.net/manual/en/function.array-merge.php Ahmed Abdel-Aliem

[PHP] Re: Saturdays and Sundays

2005-09-01 Thread Brian P. O'Donnell
Shaun [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Is it possible to get the number of saturdays and sundays for a given month / year? Thanks for your help. Here's another way to do it. Each function will return either 4 or 5. If you need both Saturdays and Sundays, just

[PHP] Re: Saturdays and Sundays

2005-09-01 Thread Brian P. O'Donnell
Sorry, I made a mistake. See below: Brian P. O'Donnell [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Shaun [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Is it possible to get the number of saturdays and sundays for a given month / year? Thanks for your

[PHP] CookieMonster

2005-09-01 Thread Gustav Wiberg
Hi Simple question I guess.. How do I set a cookie so it will never expire? (I don't want it to expire) /G @varupiraten.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] CookieMonster

2005-09-01 Thread Philip Hallstrom
Simple question I guess.. How do I set a cookie so it will never expire? (I don't want it to expire) You can't really... I could delete it and that would be the same as expiring it... Best you can do is set it to expire 100 years in the future or some such... see the manual for SetCookie()

[PHP] OpenSSL CSR Resource from String

2005-09-01 Thread NinGu Software Design
Hello, Is there anyway to create a CSR resource from the string result generated with openssl_csr_export? -- /*--- Best regards, Jared D. Hurn ([EMAIL PROTECTED]) Contract Developer ---*/

Re: [PHP] CookieMonster

2005-09-01 Thread Jason Davidson
You can.. Dont include the expire argument.. or set it to 0. Jason On 9/1/05, Philip Hallstrom [EMAIL PROTECTED] wrote: Simple question I guess.. How do I set a cookie so it will never expire? (I don't want it to expire) You can't really... I could delete it and that would be the

Re: [PHP] CookieMonster

2005-09-01 Thread Mikey
Jason Davidson wrote: You can.. Dont include the expire argument.. or set it to 0. Jason On 9/1/05, Philip Hallstrom [EMAIL PROTECTED] wrote: Simple question I guess.. How do I set a cookie so it will never expire? (I don't want it to expire) You can't really... I could delete

Re: [PHP] CookieMonster

2005-09-01 Thread Philip Hallstrom
You can.. Dont include the expire argument.. or set it to 0. You sure? The manual says (last sentence): expire The time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch. In other words, you'll most likely set this with the time() function plus the

Re: [PHP] CookieMonster

2005-09-01 Thread John Nichel
Jason Davidson wrote: You can.. Dont include the expire argument.. or set it to 0. No. Do this, and the cookie will expire when you close the browser window. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] CookieMonster

2005-09-01 Thread Jason Davidson
You are right, ignore my post. Jason On 9/1/05, John Nichel [EMAIL PROTECTED] wrote: Jason Davidson wrote: You can.. Dont include the expire argument.. or set it to 0. No. Do this, and the cookie will expire when you close the browser window. -- John C. Nichel ÜberGeek

Re: [PHP] Re: Computers name?

2005-09-01 Thread Rory Browne
Your best hope is to do a reverse lookup on the IP address. On 9/1/05, Oliver Grätz [EMAIL PROTECTED] wrote: Gustav Wiberg schrieb: Hi there! Is it possible to get (retrieve) the computername of the client? I just want the name for comparing... In PHP all you get from the client is in

Re: [PHP] Help: Get the value of pi up to 200+ digits?

2005-09-01 Thread Steve Edberg
Hi - The 'precision' ini value refers, I believe, only to float numbers, not BC_math numbers (which are stored as strings). I believe the bcmath.scale parameter is the one you need. It can be set via ini_set or bcscale() - http://php.he.net/manual/en/function.bcscale.php Perhaps you

RE: [PHP] conditional statement inside while loop?

2005-09-01 Thread Jim Moseby
I'm using a while loop to display a list of people contained in my database. I'd like to assign different font colors to each depending on which city they're from, but I can't seem to get an if/elseif/else statement to work inside the while loop. Is there another way to do this?

Re: [PHP] conditional statement inside while loop?

2005-09-01 Thread Miles Thompson
At 03:52 PM 9/1/2005, z a p a n wrote: Hello everyone, I'm using a while loop to display a list of people contained in my database. I'd like to assign different font colors to each depending on which city they're from, but I can't seem to get an if/elseif/else statement to work inside the

[PHP] Port 443

2005-09-01 Thread aaronjw
Hey, Using an API for an Ecomemrce app. Wondering how I can ensure I have access to port 443 and that it's open? Thanks! A -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] session cookies

2005-09-01 Thread Don
Hi, Is there a way, using PHP, to determine if session cookies are enabled (or disabled) in the user's browser privacy settings? Thanks, Don

[PHP] conditional statement inside while loop?

2005-09-01 Thread z a p a n
Hello everyone, I'm using a while loop to display a list of people contained in my database. I'd like to assign different font colors to each depending on which city they're from, but I can't seem to get an if/elseif/else statement to work inside the while loop. Is there another way to do this?

Re: [PHP] Help: Get the value of pi up to 200+ digits? -- oops

2005-09-01 Thread Steve Edberg
Oops...I didn't see the earlier message that BC functions were not enabled on your server. So, I'd have to concur with Oliver Grätz's suggestions, and add some of my own: - can you change hosts? - are you allowed to install software in your own directory? You may be able to

Re: [PHP] CookieMonster

2005-09-01 Thread Tom Dodson
You can.. Dont include the expire argument.. or set it to 0. Jason Sorry for clogging your inbox, Jason, I didn't CC: the list the first time. if you don't set the expire argument (it's optional), the cookie expires at the end of the browser session. I think the best you can do is set

Re: [PHP] Port 443

2005-09-01 Thread Philip Hallstrom
Using an API for an Ecomemrce app. Wondering how I can ensure I have access to port 443 and that it's open? use fsockopen() to open a socket connection to the host on port 443. You should at least connect... if it fails to connect, it's not open... -philip -- PHP General Mailing List

Re: [PHP] session cookies

2005-09-01 Thread Philip Hallstrom
Is there a way, using PHP, to determine if session cookies are enabled (or disabled) in the user's browser privacy settings? Set a cookie using setcookie(). Then use an HTML meta refresh (or javascript, just not Header(Location...) to redirect them to another page. On that page, see if the

Re: [PHP] Re: Saturdays and Sundays

2005-09-01 Thread Jason Davidson
Here is an another approach.. if you glance at a calendar, youll notice that the only times there are 5 sats in a month, is when the 1st of 30 day month falls on a fri or sat.. or in a 31 day month, a thur, fri, or say.. So, you could simply test the weekday the first of the month has, and the

Re: [PHP] session cookies

2005-09-01 Thread Mikey
Jasper Bryant-Greene wrote: Philip Hallstrom wrote: Then use an HTML meta refresh (or javascript, just not Header(Location...) to redirect them to another page. Why not header(Location...)? Just out of interest -- it's always worked for me, and it's a much better way to redirect users for

Re: [PHP] session cookies

2005-09-01 Thread Philip Hallstrom
Philip Hallstrom wrote: Then use an HTML meta refresh (or javascript, just not Header(Location...) to redirect them to another page. Why not header(Location...)? Just out of interest -- it's always worked for me, and it's a much better way to redirect users for many reasons[1] (like not

Re: [PHP] session cookies

2005-09-01 Thread Jasper Bryant-Greene
Philip Hallstrom wrote: Then use an HTML meta refresh (or javascript, just not Header(Location...) to redirect them to another page. Why not header(Location...)? Just out of interest -- it's always worked for me, and it's a much better way to redirect users for many reasons[1] (like not

Re: [PHP] session cookies

2005-09-01 Thread Jasper Bryant-Greene
Mikey wrote: Jasper Bryant-Greene wrote: Philip Hallstrom wrote: Then use an HTML meta refresh (or javascript, just not Header(Location...) to redirect them to another page. Why not header(Location...)? Just out of interest -- it's always worked for me, and it's a much better way to

Re: [PHP] session cookies

2005-09-01 Thread Gustav Wiberg
Hi there! Try using ob_start() and then set sessions, and then user HEADER... http://se.php.net/manual/sv/function.ob-start.php /G @varupiraten.se - Original Message - From: Philip Hallstrom [EMAIL PROTECTED] To: Jasper Bryant-Greene [EMAIL PROTECTED] Cc: php list

[PHP] Impossible???

2005-09-01 Thread Gustav Wiberg
Hi again! Is this impossible to do in PHP? Dim objNet On Error Resume Next 'In case we fail to create object then display our custom error Set objNet = CreateObject(WScript.NetWork) If Err.Number 0 Then'If error occured then display notice MsgBox Don't be Shy. vbCRLF _

[PHP] Re: htpasswd-style password generation w/PHP

2005-09-01 Thread Oliver Grätz
http://www.thewebmasters.net/php/class.Htpasswd.phps Google htpasswd php, first hit. Don't people use search engines any more? AllOLLi Mal: How drunk was I last night? Jayne: I don't know. I passed out. [firefly 06] -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

[PHP] Re: htpasswd-style password generation w/PHP

2005-09-01 Thread Oliver Grätz
http://www.thewebmasters.net/php/class.Htpasswd.phps Google htpasswd php, first hit. Don't people use search engines any more? AllOLLi Mal: How drunk was I last night? Jayne: I don't know. I passed out. [firefly 06] -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

[PHP] Re: (Yet another) I'm blind ... post

2005-09-01 Thread Oliver Grätz
On a totally unrelated note: My god, is that ugly code! If I see this right there's only a single piece of real PHP in it: putting the variable in the action field. For the rest: Leave PHP an use pure HTML. Or use a decent form toolkit. like PEAR's HTML_Quickform. There's no point in tons of

Re: [PHP] String format problem

2005-09-01 Thread Oliver Grätz
Please keep in mind you are speaking about microseconds of performance improvements. Optimising on this level is complete and utter nonsense. Using output buffering may give your application a much higher performance boost. And then you can still use a cache (opcode cache, page cache, ...) which

Re: [PHP] session cookies

2005-09-01 Thread Chris Shiflett
Philip Hallstrom wrote: Is there a way, using PHP, to determine if session cookies are enabled (or disabled) in the user's browser privacy settings? Set a cookie using setcookie(). Then use an HTML meta refresh (or javascript, just not Header(Location...) to redirect them to another page.

Re: [PHP] session cookies

2005-09-01 Thread Chris Shiflett
Jasper Bryant-Greene wrote: That is not true. The output to the client will look like this: HTTP/1.1 302 Found Set-Cookie: name=value;domain=whatever Location: http://my.domain.com/my.php [...] Very nice explanation. :-) It is a common misconception that header('Location: ...') redirects the

Re: [PHP] session cookies

2005-09-01 Thread Rasmus Lerdorf
Chris Shiflett wrote: Jasper Bryant-Greene wrote: That is not true. The output to the client will look like this: HTTP/1.1 302 Found Set-Cookie: name=value;domain=whatever Location: http://my.domain.com/my.php [...] Very nice explanation. :-) It is a common misconception that

RE: [PHP] conditional statement inside while loop?

2005-09-01 Thread Murray @ PlanetThoughtful
Hello everyone, I'm using a while loop to display a list of people contained in my database. I'd like to assign different font colors to each depending on which city they're from, but I can't seem to get an if/elseif/else statement to work inside the while loop. Is there another way to do

[PHP] Re: Impossible???

2005-09-01 Thread John thegimper
Yes, check out the great documentation at http://www.php.net/docs.php It's available in several languages. Great place to learn the wounderful world of php. - Original Message - From: Gustav Wiberg [EMAIL PROTECTED] Newsgroups: php.general To: PHP General php-general@lists.php.net

[PHP] Allowing access to only one host/referer

2005-09-01 Thread Dan Rossi
Hi there, i was wondering how I could allow access to a script from another server/host only ? Its prob a silly question but i guess get their host ip ? The thing with that is one server which is a webpage has a javascript popup to load the script on the other server, and i believe that in

[PHP] Viewing Binary format.

2005-09-01 Thread Soh Andy
Hi currently i have a problem with viewing chinese characters that is passed to me in binary format.. for english it just show as it is.. but for chinese how do you convert it to a readable format? currently im just seeing chinese characters passed to me like this

Re: [PHP] Allowing access to only one host/referer

2005-09-01 Thread Jasper Bryant-Greene
Dan Rossi wrote: Hi there, i was wondering how I could allow access to a script from another server/host only ? Its prob a silly question but i guess get their host ip ? The thing with that is one server which is a webpage has a javascript popup to load the script on the other server, and i