Here's my code:  $words = array(); $word = "this"; $words[] = $word; $word = "that"; $words[] = $word; print_r($words);  class word{     private $text;     public function __construct($word){         $this-&gt;text=$word;     }      public function setWord($word){         $this-&gt;text=$word;     } }  $class_words = array(); $word = new word("this"); $class_words[] = $word; $word-&gt;setWord("that"); $class_words[] = $word; print_r($class_words); exit;    Here's the output:  Array (     [0] =&gt; this     [1] =&gt; that ) Array (     [0] =&gt; word Object         (             [text:word:private] =&gt; that         )      [1] =&gt; word Object         (             [text:word:private] =&gt; that         )  )   I expected the second output to match the first in that the array should store 'this' and 'that'.  It seems array_name[] = &lt;item&gt; makes a copy to the item when it's an array of values but not so when it's an array of objects.  How do I make it copy the object to the array instead copying a reference to the object?  Do I need to create a new object each time I need to add an object to the array?
It appears that in PHP objects are passed by reference. Even assignment operators do not appear to be creating a copy of the Object.  Here's a simple, contrived proof:  &lt;?php  class A {     public $b; }   function set_b($obj) { $obj-&gt;b = "after"; }  $a = new A(); $a-&gt;b = "before"; $c = $a; //i would especially expect this to create a copy.  set_b($a);  print $a-&gt;b; //i would expect this to show 'before' print $c-&gt;b; //i would ESPECIALLY expect this to show 'before'  ?&gt;   In both print cases I am getting 'after'  So, how do I pass $a to set_b() by value, not by reference?
Does Ubuntu come with a preinstalled or automatic firewall? If not, do I need one?   I've read some articles about the advantages of Linux over other operating systems about security (no need to have antivirus, ...) but would like to be sure. Let $R=\frac{\mathbb{C}[x,y]}{\langle x^2-y^2-1 \rangle}$. Prove that (1) $R$ is an integral domain. (2) Any nonzero prime ideal of $R$ is maximal.  My idea: (1) The first part is easy. Since $x^2-y^2-1\in \mathbb{C}[y][x]$ is Eisenstein with respect to the prime $y+i$, it is irreducible. Hence the ideal generated by it is a prime ideal. (2) I am struggling with this part. I have one approach (not sure if correct). Approach : Let $I=\langle x^2-y^2-1 \rangle$. Then $R=\mathbb{C}[x,y]/I$.  Any ideal of $R$ is of the form $J/I$ where $J\subseteq \mathbb{C}[x,y]$ is an ideal containing $I$. If we can show that any prime ideal $J$ containing $I$ is maximal, then we are done. How to prove this? Is there any other way to prove the second part? Edit: I am trying to avoid Hilbert Nullstellensatz and the notion of dimension of a ring, as these concepts are not there in the syllabus of the exam from which I found this question. Find all natural numbers $n &gt; 1$ and $m &gt; 1$ such that $1!3!5!\cdots(2n - 1)! = m!$   I have been thinking about coming up with some inequalities which would narrow the possible range of pairs $(n, m)$, however the best I have been able to find so far are $m \ge 2n - 1$ and $m \lt n^2$, which is clearly not enough.  Update. The question has tag combinatorics as it is from a book about combinatorics, so there must be at least partly combinatorial solution. Finding UMVUE of $\theta$ when the underlying distribution is exponential distribution Hi I'm solving some exercise problems in my text : "A Course in Mathematical Statistics".  I'm in the chapter "Point estimation" now, and I want to find a UMVUE of $\theta$ where $X_1 ,...,X_n$ are i.i.d random variables with the p.d.f $f(x; \theta)=\theta e^{-\theta x}, x\gt0$.   I know that $E(X_i)=1/\theta,$ for each $i$, and also have that $\bar{X}$ (or equivalently $\sum_1^n X_i$) is a complete sufficient statistic for $\theta$. But I cannot go any further here. Somebody can help me? How can I include custom post types on a tag page? I'm using custom post types, but they don't appear on tag pages along with regular posts and i'd like to include both standard and custom post types on tag or category pages. What would be required before the loop to include all posts? (including custom type). Updated: To add, I found this code , which worked perfectly for the first part: add_filter('pre_get_posts', 'query_post_type'); function query_post_type($query) {   if ( is_category() || is_tag() &amp;&amp; empty( $query-&gt;query_vars['suppress_filters'] ) ) {     $post_type = get_query_var('post_type');     if($post_type)         $post_type = $post_type;     else         $post_type = array('post','cpt'); // replace cpt to your custom post type     $query-&gt;set('post_type',$post_type);     return $query;     } }  Second question still remains though: Is there a way to allow readers to filter by post type? So either of the following would work..  example.com/tag/blue?post_type=custom example.com/tag/blue?post_type=post How to export data with tab delimiters using Apex Data Loader? The internet vaguely says that this is possible. I need this feature to export translation values from a custom object and then import this back into Salesforce using translation workbench. Translation workbench accepts:   Field delimiter: Tab Character delimiter: None   How can we achieve a tab delimited data export from a custom object using Apex Data Loader? C# Regular Expressions with \Uxxxxxxxx characters in the pattern How would I implement a binary search using just an array? How to get child process from parent process How do we know the brain flips images projected on the retina back around? Why do we turn images upside down again rather than dealing with them directly, still vertically rotated after passing through our lens?   I don't see how that would cause any problems, and how we'd ever be able to figure out if we are presented with flipped images after getting used to interacting based on visual input, whether flipped or not.   What am I missing? Compile Views in ASP.NET MVC (This is not homework; a friend shared with me this puzzler and neither of us can figure it out.) Suppose you are in a plane traveling at velocity $v_1$ relative to the ground. The flight attendent pushes a cart of mass, say, $m$, accelerating it from rest to $v_2$, relative to the plane (so relative to the ground, its velocity goes from $v_1$ to $v_1+v_2$). From your perspective, the work done is then $$W = \Delta E = \dfrac{1}{2}mv_2^2$$ but from the perspective of the ground, the work done is $$W = \Delta E = \dfrac{1}{2}m(v_1+v_2)^2 - \dfrac{1}{2}mv_1^2 = \dfrac{1}{2}mv_2^2 + mv_1v_2.$$ Why are these quantities unequal?  I've seen some similar problems, like a body colliding with a wall in different reference frames, but I don't have the physics experience to tell if that question is analogous to this one. So, my apologies if this is a duplicate. :) Who is the Community user? I see the  on the user page.  It seems to edit posts sometimes.  What is it? And why has it downvoted over 1800 times? See also: What are the requirements to get the "Weed Eater" hat? The hat's description says     answer a question qualifying for the Tumbleweed badge that gets accepted   During the winter bash, I  a question that is a , and it got accepted; yet I did not get the hat. However  answer  and did get the hat. (What was the difference?)  So what are the exact requirements to get the  hat? How much electronics and other valuables can I bring duty-free when going to India? Other than looking at the profile, is there a way to find out someone's real name? A user on SO, Abhijit, referred to the OP of a question, acpigeon, as "he" (and then Aaron) .  I didn't see the name on the question page, nor on . Is there a way to look this up that I missed? Alternatives are Abhijit knows acpigeon, or maybe Abhijit was just making things up.  I'm still relatively new to these sites, so I'm still learning my way around. Is there a way short of the two alternatives above to know the OP's name? If so, how? For the past couple of weeks, a process identified as usernoted appeared to "take over" my machine after a few hours of use, eating over 99% of available CPU.  Force quitting the process doesn't help; only a system restart puts usernoted to sleep for a while.  What is this process and how do I get it under control?  I am running OS X 10.10.5 (build 14F1021). In bash, calling foo would display any output from that command on the stdout.  Calling foo &gt; output would redirect any output from that command to the file specified (in this case 'output').  Is there a way to redirect output to a file and have it display on stdout? I am not a native English speaker, I usually hear “something caught my eye” but never “something caught (both) my eyes”. This seems pretty strange to me.  Cambridge Dictionaries Online provide these examples but without any explanation        (i) to get someone's ​attention:   A ​sudden ​movement ​caught my ​eye.        (ii) to get someone's ​attention, ​especially by ​looking at them:   I ​tried to catch the waiter's ​eye, so we could ​order.        (iii) to be ​attractive or different enough to be ​noticed by someone:   It was the ​unusual ​colour of his ​jacket that ​caught my ​eye.   Why is only one eye ‘caught”? Doesn't something catch our sight? We normally see with both eyes, not with one. How to typeset subscript in usual text mode?