473,394 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Argument

Hello Newsgroup,

I'm attempting to try some stuff in PHP 4.3.2 (Old.. old version)

Basically I have something like this:

class MyClass {
function someMethod($a,$b){
echo "[$a, $b]";
}
function foot() {
// someMethod sees "Dog","Dog" ?????????????
$this->someMethod("Cat","Dog");
$file = $this->filename();
include($file);
}

}
--------------------------------------------
filename.php:
html stuff.... this gets included from the foot() method.
<?php $this->foot(); ?>
---------------------------------------------
In the above code, both $a AND $b are set to "Dog".

If I have:

someMethod($a, $b = FALSE) { }

Both $a and $b are FALSE.

The above works fine in PHP 5.n but NOT earlier versions.

I've tried other methods, sometimes they work, sometimes not
with seemingly little rhyme nor reason.
What functions, if any, are causing $a and $b to BOTH be set
to "Dog" ???

Jamie
--
http://www.geniegate.com Custom web programming
gu******@lnubb.pbz (rot13) User Management Solutions
Apr 20 '06 #1
2 1154
> What functions, if any, are causing $a and $b to BOTH be set
to "Dog" ???


It's a mystery to be sure. I would say that the someMethod("Cat","Dog")
is not called if you are not getting the output "[Cat, Dog]". Also I
think that the script would produce infinate output since foot()
includes a file that calls foot() and you get stuck in a loop.

Is this the actual code you are using, or have you tried to make it
simpler so that it's more easily understood?

Apr 20 '06 #2
In <11**********************@j33g2000cwa.googlegroups .com>,
"fletch" <ri****************@googlemail.com> mentions:
What functions, if any, are causing $a and $b to BOTH be set
to "Dog" ???


It's a mystery to be sure. I would say that the someMethod("Cat","Dog")
is not called if you are not getting the output "[Cat, Dog]". Also I
think that the script would produce infinate output since foot()
includes a file that calls foot() and you get stuck in a loop.

Is this the actual code you are using, or have you tried to make it
simpler so that it's more easily understood?


I tried to simplify it. (I think I screwed up in the example, as it
was NOT caught in a loop, in a nutshell, I had:

class MyClass {
function display(){
include("some_file.php");
}
function foot(){
include('foot.php');
}
}

I tried to reproduce it using a few test files and wasn't able to.
where some_file.php accesses '$this->foot()' and foot() in turn
access some stuff using vsprintf() among other things.
I "fixed" the problem by removing some code in another area that
was using references.. (Oh how I miss perl's \$var syntax..)

I had: 'function &getParam($name);' that returned a reference
to an array element.

Anyhow, converting a method that was returning a reference to
a method that returns by-value (and just accessing the variables
directly when I want a reference) solved it. Albeit in a way
that I didn't want.

I now have "function getParam($name)" it works. Still, it bugs me
that I don't know why the call stack got messed up.
Jamie
--
http://www.geniegate.com Custom web programming
gu******@lnubb.pbz (rot13) User Management Solutions
Apr 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steven Bethard | last post by:
So I've been playing around with trying to add a keyword argument to min and max that works similarly to the one for sorted. It wasn't too hard actually, but it does raise a few questions about...
4
by: aling | last post by:
What's the rule of default argument of function in C++? I found that the default argument of function could not necessary be a constant value. Is it true? Previously I thought that the default...
5
by: Booted Cat | last post by:
I've seen lots of discussions on the proposed inclusion of "function call with named arguments" to C/C++ on these newsgroups. My proposal is slightly different in that: * No ANSI approval is...
17
by: Charles Sullivan | last post by:
The library function 'qsort' is declared thus: void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); If in my code I write: int cmp_fcn(...); int...
11
by: vbgunz | last post by:
Hello all, I am just learning Python and have come across something I feel might be a bug. Please enlightenment me... The following code presents a challenge. How in the world do you provide an...
4
by: Patient Guy | last post by:
Does anyone have any coding rules they follow when doing argument checking? When arguments fail during check, do you return from the call with an ambiguous return value, or do you throw...
10
by: Immortalist | last post by:
Various aquisition devices that guide learning along particular pathways towards human biases. And as E.O. Wilson might say mental development appears to be genetically constrained. (1) Language...
8
by: A. Anderson | last post by:
Howdy everyone, I'm experiencing a problem with a program that I'm developing. Take a look at this stack report from GDB - #0 0xb7d782a3 in strlen () from /lib/tls/i686/cmov/libc.so.6 #1 ...
4
by: robert | last post by:
On a server the binary (red hat) installed python2.4 and also a fresh compiled python2.5 spits "sem_post: Invalid argument". What is this and how can this solved? Robert ============== ...
5
by: puzzlecracker | last post by:
C++ standard says the following: I am reading through c++ standard and have a difficulty understanding the difference between these two terms. Thanks, puzzlecracker
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.