By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,828 Members | 1,238 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,828 IT Pros & Developers. It's quick & easy.

contents of var changing, seemingly without reason

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a

"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.