Re: pdflib, NEED HELP with function problem (newby)

From: Date: Fri, 26 Jul 2002 05:24:23 +0000
Subject: Re: pdflib, NEED HELP with function problem (newby)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-109674@lists.php.net to get a copy of this message
On Friday 26 July 2002 08:39, Jeffrey wrote: > Hello, > > Using php v 4.2.2 with pdflib support, on apache v. 1.3, and redhat > linux 7.2. > > I for some reason can not get a pdf_setfont, pdf_set_text_pos, > pdf_[anything], to work inside a function. What is going on. All the pdf > extensions work find as long as I dont try to use them inside a function > that I create. > > ie: > > PDF_set_text_pos($p, 80, 670); > PDF_show($p, "Requirements:"); > > works just fine outside of a function but if I put the same thing inside a > function like so > > > function help() > { > PDF_set_text_pos($p, 80, 670); > PDF_show($p, "Test:"); > } > > I will not get Test text to display inside the PDF document, Because $p is undefined inside your function. Use: global $p inside your function. Read manual --> Variables --> Variable scope for full details. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Once you've seen one nuclear war, you've seen them all. */

« previous php.general (#109674) next »