469,627 Members | 953 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,627 developers. It's quick & easy.

contents of var changing, seemingly without reason

Please look at these few lines of code. You'll see that I keep echoing
out the variable $name. And each time, I'm getting the correct result.
But then, when it is used in an error statement, it is missing the
first letter. How can this be? Does anyone see a place where $name is
being changed? Below you can see the output.

// 04-26-04 - now we want just the name, without the parentheses.
$location1 = strpos($name, "(");
echo "here is the name: $name <br> ";
$location1 = $location1;
$name = substr($name, 0, $location1);
echo "here is the name: $name <br> ";
if (in_array($name, $allowedFunctions)) $allowed = true;
if ($allowed) {
echo "here is the name: $name <br> ";
$this->import($name, " in checkTemplateForAllowedFunctions(), in
the class McControllerForAll.");
echo "here is the name: $name <br> ";
} else {
echo "here is the name: $name <br> ";
echo "Sorry, but we did not recognize the name of a PHP function
in the template or arrangement we were asked to show. We were given
'$name', which we did not recognize as being in the official list.
These are the officially allowed PHP functions: ";
reset($allowedFunctions);
while (list($key, $val) = each($allowedFunctions)) {
echo "$val \n<br />";
}
die();
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Below is the output>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


here is the name: showNav2(4);
here is the name: showNav2
here is the name: showNav2
here is the name at the top of import(): showNav2 here is the name:
showNav2
Sorry, but we did not recognize the name of a PHP function in the
template or arrangement we were asked to show. We were given
'howNav2', which we did not recognize as being in the official list.
These are the officially allowed PHP functions:
McDatastoreConnectorMySql
McDatastoreForSessionInfoMySql
McDatastorePageInfoMySql
McDatastoreResultsMySql
McQueryObjectMySqlGetDefaultTemplateId
addBuiltInLinkToNavForm
bulkInputOfList
checkPassword
Jul 17 '05 #1
1 1458

"lawrence" <lk******@geocities.com> wrote in message
news:da**************************@posting.google.c om...
Please look at these few lines of code. You'll see that I keep echoing
out the variable $name. And each time, I'm getting the correct result.
But then, when it is used in an error statement, it is missing the
first letter. How can this be? Does anyone see a place where $name is
being changed? Below you can see the output.
<snip>

Weird - it works for me. If you snipped this code out and did it standalone,
does it still fail on your machine? Here's what I used (the concatenation in
the final echo is for ease of reading, it works regardless whether it's all
on one line or this way):

<?php
$name="showNav2(4)";
$location1 = strpos($name, "(");
echo "here is the name: $name <br> ";
$location1 = $location1;
$name = substr($name, 0, $location1);
echo "here is the name: $name <br> ";

echo "here is the name: $name <br> ";
echo "Sorry, but we did not recognize the name of a PHP function ".
"in the template or arrangement we were asked to show. We were given ".
"'$name', which we did not recognize as being in the official list. ".
"These are the officially allowed PHP functions: ";?


Garp
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by chris | last post: by
4 posts views Thread by ioneabu | last post: by
3 posts views Thread by Michael | last post: by
1 post views Thread by Howard Charles | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.