|
From: <ja...@si...> - 2002-10-18 11:13:04
|
OK, I understand it now. So if sscanf() isn't designed to take pass by
references, why do all the examples in the PHP manual use them? What good
does it do?
-Jared
> hello jared!
>
> passing by reference is sending a pointer to a variable to the function,
> instead of actually sending the variable to the function, which it uses
> to create a local variable within the function. when the function makes
> a change to it's variable, it updates the variable outside the function
> (The one you pointed to) since it's local copy is really "pointing" to
> your variable.
>
> function($arg) passing the value
> function(&$arg) passing the reference
>
> basically, if you have code like this:
>
> my_function(&$arg)
> {
> $arg=4; //no need to return
> }
>
> $a=7;
> my_function(&$a);
> echo $a;
>
> it would print "4"...
>
> NOW the error php now generates is "call time pass by reference is
> deprecated"
>
> which means you can't define a function like this:
>
> my_function($arg) {
> blah
> }
>
> and call it like this:
>
> my_function(&$a);
>
> in this case you would be stuffing the reference down the function's
> throat. the php guys really think that we should let php know that we
> actually want the reference sent to our function. In the case of the
> error message that was posted to this ng, the function declaration
> doesn't ask for references. the message points out that you can go in
> and modify the declaration if you want and rebuild php, or simply turn
> the warning off altogether. But if you do either you can't count on your
> program working in the future, or on someone else's machine.
>
> The php people are probably are looking to streamline the engine, and
> provide some good ole safe sanity enforcement to the reckless jungle one
> can create in php.
>
> But these are just my opinions.
>
> back in the old days you could practically walk into to town and get
> into a gun slinging fight in the middle of town, and hop back on your
> horse and head out without too much trouble. what i really mean is there
> was so much "slop" in php that most of the serious programmers wouldn't
> touch it with a ten foot pole.
>
> one day we will probably even have to define variable types in php
> beforehand.
>
> when i started using Personal Home Page ;-) i think it was actually
> refreshing programming in the slop. it even felt powerful. i mean, in
> real structured languages it sometimes feels like you spend more time
> typing all this extra crap in that is mostly meaningless - than doing
> real coding. but you learn that there are lots of really good reasons
> for the structure, and the type-checking and all that Alte Schule bars,
> bricks and stones stuff that php is slowing drifting toward.
>
> and i am pretty much still a young feller.
>
>
> Take care
>
> Waitman
>
>
>
>
> On Thu, 2002-10-17 at 17:25, Jared wrote:
> I don't understand exactly what "passing by reference" is and why I
> can't find any information about it being deprecated on the PHP
> website. I also want to know why all sscanf() function examples in
> the function list on the PHP website use references like we did and
> you say removing the & still allows the script to function
> normally. I don't understand the purpose of the & in the first
> place, then.
>
> I understand what & does, but I've never used it before and I'm not
> sure why it is or is not needed in that case.
>
> Anyway, Chad rewrote it so it doesn't even use sscanf so it no
> longer uses the & either.
>
> -Jared
>
> On Thursday, October 17, 2002, at 06:49 PM, Waitman C. Gobble
> wrote:
>
> > no, he is likely running a newer version of php.
> >
> > the fix is simple. pass by reference is deprecated, and support
> may cease in future builds of php. removing the & signs will
> remove the error (does not send references to the variables), and
> the script functions properly...
> >
> > take care
> >
> > waitman
> >
> >
> > On Thu, 2002-10-17 at 16:40, Chad wrote:
> > Your probably running an older version of PHP. You have four
> > options:
> >
> > 1) Update your PHP build
> > 2) Set allow_call_time_pass_reference to true in your INI
> file. 3) Download the latest version of PHP iCalendar from
> CVS. 4) Wait for 0.7, which should be out in a day or three.
> >
> >
> > On Thursday, October 17, 2002, at 09:50 PM, Steve Klenert
> wrote:
> >
> >> Just installed and i get this :
> >>
> >> Warning: Call-time pass-by-reference has been deprecated -
> argument passed
> >> by value; If you would like to pass it by reference, modify the
> declaration
> >> of sscanf(). If you would like to enable call-time
> pass-by-reference, you
> >> can set allow_call_time_pass_reference to true in your INI file.
> However,
> >> future versions may not support this any longer.
> >> in /home/sites/site3/web/calendars/functions/ical_parser.php on
> line 563
> >>
> >> Warning: Call-time pass-by-reference has been deprecated -
> argument passed
> >> by value; If you would like to pass it by reference, modify the
> declaration
> >> of sscanf(). If you would like to enable call-time
> pass-by-reference, you
> >> can set allow_call_time_pass_reference to true in your INI file.
> However,
> >> future versions may not support this any longer.
> >> in /home/sites/site3/web/calendars/functions/ical_parser.php on
> line 563
> >>
> >> Parse error: parse error, expecting `')''
> >> in
> /home/sites/site3/web/calendars/functions/overlapping_events.php
> on line
> >> 69
> >>
> >> Fatal error: Call to undefined function: checkoverlap()
> >> in /home/sites/site3/web/calendars/functions/ical_parser.php on
> line 548
> >>
> >> Please help ASAP>
> >>
> >> --
> >> Best Regards,
> >> Steve Klenert
> >> Digital Princeton
> >> "Quality in Service and Support is our #1 GOAL!"
> >> -=Hosting=--=Web Design=--=Dedicated Servers=--=Co-Location=-
> -=High Bandwidth Hosting Options=--=Load Balanced Servers=-
> www.digitalprinceton.net
> >> Emergency Contact: Pag...@Di...
> >>
> >>
> >> -------------------------------------------------------
> >> This sf.net email is sponsored by: viaVerio will pay you up to
> $1,000 for every account that you consolidate with us.
> >> http://ad.doubleclick.net/clk;4749864;7604308;v?
> >> http://www.viaverio.com/consolidator/osdn.cfm
> >> _______________________________________________
> >> Phpicalendar-devel mailing list
> >> Php...@li...
> >> https://lists.sourceforge.net/lists/listinfo/phpicalendar-devel
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by: viaVerio will pay you up to
> $1,000 for every account that you consolidate with us.
> > http://ad.doubleclick.net/clk;4749864;7604308;v?
> > http://www.viaverio.com/consolidator/osdn.cfm
> > _______________________________________________
> > Phpicalendar-devel mailing list
> > Php...@li...
> > https://lists.sourceforge.net/lists/listinfo/phpicalendar-devel
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by: viaVerio will pay you up to
> $1,000 for every account that you consolidate with us.
> > http://ad.doubleclick.net/clk;4749864;7604308;v?
> > http://www.viaverio.com/consolidator/osdn.cfm
> > _______________________________________________
> > Phpicalendar-devel mailing list
> > Php...@li...
> > https://lists.sourceforge.net/lists/listinfo/phpicalendar-devel
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: viaVerio will pay you up to
> $1,000 for every account that you consolidate with us.
> http://ad.doubleclick.net/clk;4749864;7604308;v?
> http://www.viaverio.com/consolidator/osdn.cfm
> _______________________________________________
> Phpicalendar-devel mailing list
> Php...@li...
> https://lists.sourceforge.net/lists/listinfo/phpicalendar-devel
>
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: viaVerio will pay you up to
> $1,000 for every account that you consolidate with us.
> http://ad.doubleclick.net/clk;4749864;7604308;v?
> http://www.viaverio.com/consolidator/osdn.cfm
> _______________________________________________
> Phpicalendar-devel mailing list
> Php...@li...
> https://lists.sourceforge.net/lists/listinfo/phpicalendar-devel
|