php-general Digest 27 Jul 2006 10:20:46 -0000 Issue 4261

Topics (messages 239832 through 239838):

Re: APC + "Fatal error: Cannot redeclare class..."
        239832 by: jon

fpdf
        239833 by: João Cândido de Souza Neto
        239834 by: Peter Lauri

Return Values Copied? Copied if By Reference?
        239835 by: Michael B Allen
        239836 by: Robert Cummings
        239837 by: Larry Garfield

Problem with rawurlencode and euro sign.
        239838 by: Mathijs

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message --- Thanks man... it turns out that I really was redeclaring the class, but it didn't throw an error until I added APC.

Kinda weird, yeah? Anyway... it's all good now.

        -- jon


Jochem Maas wrote:
jon wrote:
So... I've got some code that works just fine without APC, but dies when
I add it.

Here's the error:
Fatal error: Cannot redeclare class

that error doesn't tell us much more than you in the context you give...
but I'm gonna put money on the fact that your doing something like 
include_once()ing
some class file then include_once()ing the same file but with a different 
[relative]
path and that APC is getting confused thinking that these files are different...

try going through you code and making all [include|require]_once calls to use a 
single
form of path (i.e. that all includes for a given file are identical)

you can use echo statements in the top of each class file to track down which 
class is
seemingly being included twice.

if all that fails you can still use the 'apc.filter' ini setting to exclude 
certain
files from being cached (using regexp declarations to exclude files based on 
filename)
- this assumes your class files have a 'std' naming convention (e.g. 
Foo.class.php).
I use the same technique to stop class definitions being cached to overcome a 
problem
that my cached class defs cause segfault which I can figure out (that reminds 
me I
should try a newer version of APC if it's been release :-)

php -v =
PHP 5.1.2 (cli) (built: Jul 18 2006 23:21:00)

... any ideas what's up? Obviously, there are other ways I can improve
performance on that box, but I'd love to try APC.

Thanks...
    -- jon





--- End Message ---
--- Begin Message ---
Hi everyone.

Could someone tell me if fpdf class can write the pdf file into the server? 
I've reading about and just found that it save the pdf document in a local 
place or open it in browser.

I need to write it in server, it's possible?

Thanks a lot. 

--- End Message ---
--- Begin Message ---
Yes you can...

$pdf->Output("thelocation/filename.pdf", "F");

Just make sure that thelocation has permission to write for the web server.

/Peter

-----Original Message-----
From: João Cândido de Souza Neto [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 27, 2006 7:05 AM
To: [email protected]
Subject: [PHP] fpdf

Hi everyone.

Could someone tell me if fpdf class can write the pdf file into the server? 
I've reading about and just found that it save the pdf document in a local 
place or open it in browser.

I need to write it in server, it's possible?

Thanks a lot. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Is a function return value copied? If the value is an integer I suppose
it is but what about a string or an array? If you pass by reference is
the return value still copied?

For example, is this:

  function foo(&$arr) {
      $arr[] = "bar";
  }

faster than this?

  function foo(&$arr) {
      $arr[] = "bar";
      return $arr; // is this copied?
  }

I'm working on some code that would be called to generate a cell in a
possibly large table and therefore a small difference in performance
may have a significant impact.

Thanks,
Mike

-- 
Michael B Allen
PHP Extension for SSO w/ Windows Group Authorization
http://www.ioplex.com/

--- End Message ---
--- Begin Message ---
On Wed, 2006-07-26 at 22:29, Michael B Allen wrote:
> Is a function return value copied? If the value is an integer I suppose
> it is but what about a string or an array? If you pass by reference is
> the return value still copied?
> 
> For example, is this:
> 
>   function foo(&$arr) {
>       $arr[] = "bar";
>   }
> 
> faster than this?
> 
>   function foo(&$arr) {
>       $arr[] = "bar";
>       return $arr; // is this copied?
>   }
> 
> I'm working on some code that would be called to generate a cell in a
> possibly large table and therefore a small difference in performance
> may have a significant impact.

PHP uses copy-on-write and so copies are essentially shared until such
time as you modify one of them. If you don't need references then copies
are faster than references.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
On Wednesday 26 July 2006 21:41, Robert Cummings wrote:

> > I'm working on some code that would be called to generate a cell in a
> > possibly large table and therefore a small difference in performance
> > may have a significant impact.
>
> PHP uses copy-on-write and so copies are essentially shared until such
> time as you modify one of them. If you don't need references then copies
> are faster than references.

By the same token, then, if I have a function that generates a large string 
and returns it, is there any benefit to return-by-reference?

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
Hello there,

I have a problem with rawurlencode().
I want to have the euro sign € to be sent by post.
To do this, first rawurlencode() encodes all the chars.

But for some reason rawurlencode encodes it to %3F or %A4.
Which i think is logical becouse that is the right position in the charset.

But i need it to be %80.

When i use rawurldecode('%80'); and put the browsers encoding to ISO-8859-* it 
does work.
i Realy see the euro sign.

So why does rawurlencode() not encodes it tho this?.

Thx in advance.

Mathijs.


---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0630-2, 07/26/2006
Tested on: 7/27/2006 12:20:37 PM
avast! - copyright (c) 1988-2006 ALWIL Software.
http://www.avast.com

--- End Message ---

Reply via email to