Page 1 of 1

Rename and several syntax query.

Posted: Thu Dec 11, 2008 6:09 pm
by FacJoe
Hi. I am new to PHP. I am coding/tracing in PHP inside a VS.Net environment and I'm using its debugger. Here are my questions.

I have the following code:

Code: Select all

if(Class::function())
1. What does the "::" mean? How does PHP evaluate it?

Code: Select all

$renamed = rename($tmp_filename, $dest_filenames[0]);               
        if (!$renamed) {
            return false;
        }
I am pretty sure that the value for the variables for $tmp_filename and $dest_filenames[0] are different. However, the $renamed variable always returns "false". I do not know why this is so.

Here's another problem I have been having:

Code: Select all

 
$page = thisfunction($thisvariable, '', $thisvariable->getId() ? $frm : null);
 
Several questions:
1. How is the syntax actually being evaluated? thisfunction((var1, var2) ? var 3 : null). I mean, what does the "?" and the ":" stand for? I am guessing it's something like, if (var1, var2) is true, then use it, otherwise use var 3 if it's false. If it cannot be evaluated to "true" or "false", use "null" instead. Am I correct?

2. I've checked the function "thisfunction" and it returns some sort of string in that's like a code in PHP. the problem is, I checked inside the function and the string was very long. When I run the debugger, the value in $page gets truncated. How can I resolve this?

Thanks in advance.

Re: Quick PHP syntax question.

Posted: Thu Dec 11, 2008 6:13 pm
by Eran
It's the scope resolution operator, also called Paamayim Nekudotayim (double colon in Hebrew). It allows access to public static methods and members of a class, as well as several other scope properties inside the class itself (parent::,self::). Read more in the manual - http://www.php.net/manual/en/language.o ... otayim.php

Re: Quick PHP syntax question.

Posted: Thu Dec 11, 2008 6:35 pm
by FacJoe
pytrin wrote:It's the scope resolution operator, also called Paamayim Nekudotayim (double colon in Hebrew). It allows access to public static methods and members of a class, as well as several other scope properties inside the class itself (parent::,self::). Read more in the manual - http://www.php.net/manual/en/language.o ... otayim.php
Thank you for your answer. I figured that one out myself a while ago. :D The link helps too.

Re: Unlike/Rename syntax query.

Posted: Thu Dec 11, 2008 6:43 pm
by Eran
The way you edited your original post is confusing. Try to mark your changes with a disclaimer (EDIT:) or simply add another post in the thread.

Re: Rename and several syntax query.

Posted: Thu Dec 11, 2008 8:34 pm
by FacJoe
BUMP!

Anyone? I'm currently having problems with the "Rename" function. Is there a bug associated with this function?

Thanks in advance.