Rename and several syntax query.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
FacJoe
Forum Newbie
Posts: 8
Joined: Sun Dec 07, 2008 7:49 pm

Rename and several syntax query.

Post 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.
Last edited by FacJoe on Thu Dec 11, 2008 7:38 pm, edited 4 times in total.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Quick PHP syntax question.

Post 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
FacJoe
Forum Newbie
Posts: 8
Joined: Sun Dec 07, 2008 7:49 pm

Re: Quick PHP syntax question.

Post 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.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Unlike/Rename syntax query.

Post 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.
FacJoe
Forum Newbie
Posts: 8
Joined: Sun Dec 07, 2008 7:49 pm

Re: Rename and several syntax query.

Post by FacJoe »

BUMP!

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

Thanks in advance.
Post Reply