>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 get this error:
>
>Warning: pdf_set_text_pos(): supplied argument is not a valid pdf object
>resource in /var/www/html/form/test.php on line 16

$p is not "in scope" inside the function.

One of the purposes of a function is to isolate all your variables so that
you can't possibly screw up somebody else's variables with your function and
vice versa.

So $p is "empty" inside of help()

You can either:

Pass in $p as an argument (best) or declare it global:

function help($p){
...
}

function help(){
  global $p;
...
}


-- 
Like Music?  http://l-i-e.com/artists.htm
I'm looking for a PRO QUALITY two-input sound card supported by Linux (any
major distro).  Need to record live events (mixed already) to stereo
CD-quality.  Soundcard Recommendations?
Software to handle the recording? Don't need fancy mixer stuff.  Zero (0)
post-production time.  Just raw PCM/WAV/AIFF 16+ bit, 44.1KHz, Stereo
audio-to-disk.

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

Reply via email to