In C++ passing variables from functions to the function caller can always have better performance when returning a variable by const &amp; (constant reference).  class A {     private:     std::string name;     public:     inline const std::string&amp; getName() { return this-&gt;name; } const }   I am wondering if returning variables from a function in PHP as a reference can have better performance then just returning a variable like normal.  In C++ I understand that when you return a variable without const ref it copies the data into the variable that you are setting it to. So you will have two locations in memory with the same data.  But when you pass around references, you are just passing the address in memory to the same data.  Is this how it works in PHP? Or does PHP do optimization regardless?  Will the following function run faster if it is written like so? Returning a reference?  public function &amp;getDatabaseConnection() { return $this-&gt;databaseConnection; }   Or does it not make much of a difference?
In PHP, function parameters can be passed by reference by prepending an ampersand to the parameter in the function declaration, like so:  function foo(&amp;$bar) {     // ... }   Now, I am aware that this is not designed to improve performance, but to allow functions to change variables that are normally out of their scope.  Instead, PHP seems to use Copy On Write to avoid copying objects (and maybe also arrays) until they are changed. So, for functions that do not change their parameters, the effect should be the same as if you had passed them by reference.  However, I was wondering if the Copy On Write logic maybe is shortcircuited on pass-by-reference and whether that has any performance impact.  ETA: To be sure, I assume that it's not faster, and I am well aware that this is not what references are for. So I think my own guesses are quite good, I'm just looking for an answer from someone who really knows what's definitely happening under the hood. In five years of PHP development, I've always found it hard to get quality information on PHP internals short from reading the source.
What is the difference between conditioning on regressors vs. treating them as fixed? Every irreducible Polynomial is primitive or irreducible constant When and why is the [featured] tag removed by the Community user? In &quot;Introduction to Mathematical logic&quot; by Elliot Mendelson , page $59$ . I couldn't understand the basic preliminary notations for the rigorous definition of Satisfiability. For example , at a line they said, &quot;Moreover, instead of talking about the $n$-tuples of objects that satisfy a wf that has $n$ free variables, it is much more convenient from a technical standpoint to deal uniformly with denumerable sequences. What we have in mind is that a denumerable sequence $s = (s_1, s_2 , s_3 , ... )$ is to be thought of as satisfying a wf $\beta$ that has ${x_j}_1 , {x_j}_2 ,  ... , {x_j}_n$ as free variables (where $j_1 &lt; j_2 &lt; ... &lt; j_n$ ) if the $n$-tuple $\langle {s_j}_1 , {s_j}_2 ,  ... , {s_j}_n \rangle$ satisfies $\mathscr B$ in the usual sense.&quot; I didn't quite understand why they used ${s_j}_1$ and ${x_j}_1$ instead of $s_1$ and $x_1$ . Maybe there is a critical detail I am missing out? Also , Another passage for the rigorous definition: &quot;Let $M$ be an interpretation of a language $\mathscr L$ and let $D$ be the domain of $M$. Let $\sum$ be the set of all denumerable sequences of elements of $D$. For a wf $\mathscr B$ of $\mathscr L$ , we shall define what it means for a sequences $s= (s_1, s_2, ... )$ in $\mathscr L$ to satisfy $\mathscr B$ in $M$. As a preliminary step, for a given s in $\sum$ we shall define a functions $s^*$ that assigns to each term $t$ of $\mathscr L$ an element $s^{*}(t)$ in $D$.&quot; They did say that for each $s = (s_1, s_2, ... )$ , there is a defined function $s^*$ , but even after further reading the text afterwards , I still did not understand how exactly $s^*$ is defined from $s$ . Can someone tell me where the gap in my understanding here is? Proving $\gcd((a+b)^m,(a-b)^m)\le2^m$ for coprime $a,b$ and $m \in \Bbb N$ I don't know what I've done, but all of a sudden I am unable to compile any document which uses the geometry package. Minimal (non)-working example:     \documentclass[11pt]{article}      \usepackage{geometry}  \begin{document} test \end{document}   doesn't produce any output, and this is what I see in my error summary screen in TeXnicCenter:    The red arrow points to what seems to be the problem: something about the bundle "oberdiek" and its package "ifvtex" is causing pdflatex.exe (which, while I don't really know what it does, sounds pretty important) to "not be initialized". I , and it's relevance here is a mystery to me.  I've confirmed that all of my files without the geometry package compile just fine; however, that doesn't mean that the problem is with the geometry package - what seems more likely is that there is some hidden cause of the error, and geometry happens to be one way to induce that. By the way, I've tried compiling a document which includes the ifpdf and ifvtex packages separately, and they do just fine; it's only when I include the geometry package (which for some reason requires these ifpdf and ifvtex packages) that the error occurs.  I've tried the only things I can think of:   going into MiKTeX Package Manager (by the way I am using 2.8), and removing + reinstalling both geometry and oberdiek refreshing the file name database ("FNDB") deleting all automatically generated files, as well as simply starting over in a new document   So I'm stuck now. I've considered attempting to just get rid of all traces of MiKTeX and TeXnicCenter from my computer and starting over, but that seems a bit excessive - after all, the geometry package was working for me . I honestly am not sure what I did to cause this; I've spent today trying to make a better template file for myself, and so I've been trying out new packages, but if I'm not loading these new packages there shouldn't be any conflicts, right?   Actually, I've just now thought of something that I think I did between the last time it worked and now, so is a possible candidate for the cause: I had to install some package manually, as it wasn't available on MiKTeX, and so I created a folder and pointed MiKTeX to it (i.e. the second option ). The package didn't do what I wanted, so I deleted the folder and removed it from the list of folders I told MiKTeX to check. Perhaps it's still trying to reach it for some reason? How to check if a String contains another String in a case insensitive manner in Java? Preview on the right please, optionally? I am aware of the basics of evolutionary theory, however I don't understand how mutations can add genes over time.   Am I correct in thinking that creatures within the same species who mutate to have an additional gene in their genome would normally be infertile?  Or am I misunderstanding that?  Can someone explain the process of the creation of genetic material through evolution?  Citation to a decent academic paper or book on the matter would be appreciated too. The product of all the elements of a finite abelian group I'm trying to prove the following statements.  Let $G$ be a finite abelian group $G = \{a_{1}, a_{2}, ..., a_{n}\}$.   If there is no element $x \neq e$ in $G$ such that $x = x^{-1}$, then $a_{1}a_{2} \cdot \cdot \cdot a_{n} = e$.   Since the only element in $G$ that is an inverse of itself is the identity element $e$, for every other element $k$, it must have an inverse $a_{k}^{-1} = a_{j}$ where $k \neq j$. Thus $a_{1}a_{1}^{-1}a_{2}a_{2}^{-1} \cdot \cdot \cdot a_{n}a_{n}^{-1} = e$.   If there is exactly one $x \neq e$ in $G$ such that $x = x^{-1}$, then $a_{1}a_{2} \cdot \cdot \cdot a_{n} = x$.   This is stating that $x$ is not the identity element but is its own inverse. Then every other element $p$ must also have an inverse $a_{p}^{-1} = a_{w}$ where $p \neq w$. Similarly to the first question, a rearrangement can be done: $a_{1}a_{1}^{-1}a_{2}a_{2}^{-1} \cdot \cdot \cdot xx^{-1} \cdot \cdot \cdot  a_{n}a_{n}^{-1} = xx^{-1} = e$. And this is where I am stuck since I proved another statement.    Any comments would be appreciated for both problems. Simple property of a valuation on a field Allow an edit to notify downvoters: "I think I've fixed the issue now - please check" To me, a downvote usually indicates a problem with an answer. When I downvote it's to mark the answer as having a problem, not the person. If the answer is fixed, I want to remove that downvote - but it's tricky to keep track of all the questions I've looked at over the last few hours.  I don't actually downvote very much, but it's very easy to forget what's going on.  It would be nice to have some way of indicating in an edit that you (the editor/answerer) believe the reason for the downvote has now been resolved, so that the downvoters could come and undo their downvotes or explain why it's still not fixed.  (Note: this isn't about rep-recovery, but quality control. I would feel a lot better about downvoting on "iffy" answers if I felt it was likely that the answer would be fixed and I could undo the vote. Whether or not I'd get back the cost of the downvote is somewhat immaterial.) Please Join Us in Welcoming Our New Meta Stack Exchange Moderators! Probably a basic issue, but still something that irks me and I can't find an answer online. I want to change the default folder for saving new shapes/processing outputs from &quot;last used folder&quot; to &quot;project folder&quot; or &quot;something in relation to project folder&quot; - is this possible? If so, how can I achieve this? What Nikon lens to buy to make photos of birds? MySQL 5.5.16 allows anonymous connections Apparently, I can connect to MySQL (at least from my localhost) without having to provide any username or password. I can even put anything as username, as long as the password is empty. I have access to the information_schema and test databases. I can create tables. If I run SELECT USER() it returns the proper value randomstring@localhost, where the random string is whatever I used for username when I connected.  The mysql.user table contains root@localhost, root@127.0.0.1, @localhost and pma@localhost. I manually set encrypted passwords to all the records (UPDATE user SET password=...) and only root has any privileges, the other two records have "N" for all privileges. That record with the empty username looks suspicious, but I don't think it has anything to do with this and I think it was there from the beginning.  To make matters worse, if I add a user with a password, I can only connect using empty string as password (just like if I put anything as username). If I try to connect using the username I created and password I supplied when creating it (CREATE USER .. IDENTIFIED BY ..) it doesn't work.  Does anyone know what is wrong and how I can fix this?  Note: I am using MySQL 5.5.16 for Windows, provided by the XAMPP package. Why is it that they decided to make String immutable in Java and .NET (and some other languages)? Why didn't they make it mutable? What is the point of isomorphism concept? Which application to preview .md files? Is there an application to preview markdown files (.md files) on OSX (for instance on Maverick)? Proof of continuity $f(x+y) = f(x) + f(y)$