I have a some data stored in $cache[], there are some number in it. How do I remove duplicate values in a printed output? :  &lt;?  #mysql connect mysql_connect($host,$user,$pass) or die(mysql_error()); mysql_select_db($name) or die(mysql_error());  function get_numerics ($str) {     preg_match_all('/\d+/', $str, $matches);     return $matches[0]; }   function validatecard($number) { //preg_match_all('/^[6-9][0-9]{9}$/', $number, $found); preg_match_all('/^[0-9]{4}$/',$number, $found);  //print_r($found); return $found[0];   }   $query = mysql_query("SELECT * FROM client WHERE status = 1 ORDER BY id")           or die(mysql_error());  while ($raw = mysql_fetch_array($query))   {  $name = $raw["postdata"]; $id = $raw["id"]; $cache = [];     for($i=0;$i&lt;=count(get_numerics($name));$i++){     $ccv = get_numerics($name);     $num = $ccv[$i];     if (is_numeric($num)) {     $cc = validatecard($num);     if (!in_array($cc, $cache)){         $cache[] = $cc; }    } }    print_r($cache);  }  ?&gt;   i have use some function like :array unique and convert it to json or serialize... and not work.
How can I remove duplicate values from an array in PHP?
I have a collection that contains linked assets. I would like to override their materials and give them a unique material. Is it possible to assign a material to a whole collection, and how ?  Thanks ! Is there a difference between "Joe said" and "said Joe"? Does the subject/verb order make a difference when writing a dialog tag?  &quot;The sky is blue,&quot; Joe said. &quot;The sky is blue,&quot; said Joe.  Is one preferable over the other? Does one emphasize the speaker (or the method of speech, such as shout) more than the other? (Personally, I would use the second form to emphasize that Joe made the statement) "Show desktop" keyboard shortcut in Mac OS X I am using a MacBook Pro with Mac OS X 10.5. Is there a similar function to "show desktop" (shortcut is WIN+D) on a Mac?   It should hide all applications and show a clean desktop. obtain a three-term asymptotic solution Why can "trans" be replaced with an x? I can't think of an example, so I may be wrong about this, but I think I've seen people replace the prefix "trans" as in transport with an x. "Cross" makes sense, as in "railroad crossing", and I guess "chris" is sort of a punny extension, the extension being like "chris cross" and the example being "xmas", but why trans? Several lines of formulas to the left of one curly brace pointing to equation number How to make several lines of equations under one curly brace from the left side, such that it point to a reference number.  Now I do something like this:  \begin{align} \left. \begin{array}{ll} a = b + c \\ &amp; \dots  \\ a = b + c \\ &amp; \dots  \\ a = b + c  \end{array} \right\} \label{formulas}\\ \end{align}   But equation number appears in the bottom of curly brace. I stumbled upon a question given like:  Let $m$ and $n$ be two integers such that $m \geq n \geq 1$.   Count the number of functions $$f: \{1, 2, · · · , n\} \to \{1, 2, · · · , m\}$$ of the following two types:  (a) strictly increasing; i.e., whenever $x &lt; y, f(x) &lt; f(y)$, and  (b) non-decreasing; i.e., whenever $x &lt; y, f(x) \leq f(y)$.  I tried in the following way.  For (a). We can say $f(n)&gt;f(n-1)$ AND $f(n)&gt;f(n-2) \ldots f(n)&gt;f(1)$ (total $n-1$ elements)  Similarly for $f(n-1)&gt;f(n-2), f(n-1)&gt;f(n-3) \ldots f(n-1)&gt;f(1)$ (total $n-2$ elements)...  and $f(2)&gt;1$  Like this $$(n-1) + (n-2) + \ldots + (1) = \frac{n(n-1)}{2}$$  Is this correct?  For (b). Since there's equality, it will be $$n + (n-1) + ... (1) = \frac{n(n+1)}{2}$$  Is my approach correct? Any help is appreciated. Thanks in advance. Is it possible to find all php files within a certain directory that have been modified on a certain date  I'm using   find /var/www/html/dir/ -mtime -28 | grep '\.php'    to get files modified within the last 28 days, but I only need files that have been modified on the following date: 2011-02-08 We all know that the amount of current flowing b/w the plates is independent of the frequency. If I were to ask why doesn't it depend then you'd probably say that it depends on the number of electrons rather than the frequency or you might show me a current vs frequency graph.  But here is my theoretical argument. Electric current is defined as the amount of charge flowing through a point/space/wire per unit time. Let I be current due to photo electrons ejected by photons of some frequency. Now if I would increase the frequency, the kinetic energy of the ejected electron would increases, therefore it will move faster and therefore contribute more current (charge will through the same point many times per unit time) . Thereby, giving a net current greater than I.  What is wrong with my argument?  After thinking a lot, I came up with a possible reason. However fast the electrons may move, but when they hit the metal plate, they would lose their velocity and start moving in drift velocity. Now there is a problem with this argument. If this were to be true then I should expect to see a big chunk of extra electrons getting stuck at the anode.  If my reasoning was correct, then why can't I see a big charge buildup at the anode. How prove that $\lim\limits_{x\to+\infty}f(x)=\lim\limits_{x\to+\infty}f'(x)=0$ if $\lim\limits_{x\to+\infty}([f'(x)]^2+f^3(x))=0$? Question:     Let $f$ be differentiable on $[0,+\infty)$, such as$$\lim_{x\to+\infty}\left([f'(x)]^2+f^3(x)\right)=0$$show that $$\lim_{x\to\infty}f(x)=\lim_{x\to\infty}f'(x)=0$$   I think this problem is similar to  and (the  background)  For my problem I guess that if  $$\lim_{x\to+\infty}\left([f'(x)]^{2m}+f^{2n+1}(x)\right)=0,m,n\in N^{+},n,m&gt;1$$ then we have $\lim_{x\to\infty}f(x)=\lim_{x\to\infty}f'(x)=0$. As I'm relatively new to the electronics world, I was wondering if you can connect multiple  ground terminals (corresponding to several different voltage outputs) to the same ground. Or do they each need their own?  In my case I have 5 lines, one 12V, one 3.3V, two 5V and one variable from a 12V in using a  voltage regulator that already has its own ground. So I'm guessing that each would need its own ground, but it is never bad to ask. I have three displays, a 4K display flanked by two 1080p displays. Physically, these monitors are roughly the same size. Furthermore, Windows 10 handles the DPI scaling of the 4K monitor separately from the 1080p monitors just fine. So while it appears as such to Windows    the real layout is three monitors of equal size side by side.  The problem is that the mouse keeps getting caught on the edges of display 2 and three when dragging from display 1. I would like the mouse to continue onto display 2 or 3 regardless of which part of the left or right edge of display 1 the mouse touches.  This question has been asked before (e.g. ) and a common answer is to suggest that this behaviour is intentional on the basis that mouse movement should reflect different size displays. Such an answer is not appropriate as it doesn't consider DPI and scaling. How to add a program as a startup application from a terminal? I am using Ubuntu 12.04 and I know the GUI way to maintain the startup program list but now I want to find out the way to add/remove startup applications using a command line interface (CLI). Can multiple render systems be used? Why do harmonics occur when you pluck a string? Why is it considered good practice to mark method parameters as final? My system freezes completely at random, frequent intervals. I started to have the same problem in Ubuntu 14.04 but after recent upgrade to 16.04 there is no improvement, in fact it seems worse.  When it happens, it's impossible to do anything. I've tried everything in this thread:  but nothing works, I have to hard reset. I have read all the system logs and journalctl but there is never any information that could help diagnose the problem.  This is a dual-boot system with Windows 10 and there's no problem there, so it's not defective hardware.  My laptop has an Intel Bay Trail processor (Pentium N3540) At what level of complexity should I consider UL listing my widget? HP Spectre x360 disable trackpad in tablet mode I have the HP Spectre x360 and when I bend the laptop back into tablet mode (360 hinges), usually the keyboard and mouse disables in Windows.   In Ubuntu 15.04 the keyboard successfully disables, but not the trackpad.   What wizardry can I perform to rectify this issue?   Hopefully I could create an actively running script where it listens for particular events (activation of tablet mode) and then disable the track pad once boolean value equals True or something. I could probably get the ball rolling if there was a command out there that would display what component is being used / activated, so I could capture the event ID or something (not sure if this is even possible, just speculating...) Integrating $\int^0_\pi \frac{x \sin x}{1+\cos^2 x}$