so i want to get the file extension from the img so if i upload a image i can use mutiple file exts but when i use this code to get the file ext it does not work  $sql = "SELECT * FROM users"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) &gt; 0) {     while ($row = mysqli_fetch_assoc($result)) {         $id = $row['user_id'];         $sql = "SELECT * FROM users WHERE user_id='$id'";         $result = mysqli_query($conn, $sql);         while ($rowImg = mysqli_fetch_assoc($result)) {             if ($rowImg['status'] == 0) {                 $filename = "../assets/IMGS/profile/Avatar".$id.".*";                 $fileinfo = glob($filename);                 $fileext = explode(".", $fileinfo[0]);                 $fileactualext = $fileext[1];                  echo "&lt;img src='../assets/IMGS/profile/Avatar".$id.".".$fileactualext."?".mt_rand()."'&gt;";             } else {                 echo '&lt;img src="../assets/IMGS/profile/def-image.png"&gt;';             }         }     } }
This is a question you can read everywhere on the web with various answers:  $ext = end(explode('.', $filename)); $ext = substr(strrchr($filename, '.'), 1); $ext = substr($filename, strrpos($filename, '.') + 1); $ext = preg_replace('/^.*\.([^.]+)$/D', '$1', $filename);  $exts = split("[/\\.]", $filename); $n    = count($exts)-1; $ext  = $exts[$n];   etc.  However, there is always "the best way" and it should be on Stack Overflow.
Downgrading from Safari 12 (beta) to Safari 11 Installing Safari beta version is apparently only possible by replacing the builtin Safari version. In this case version 11.1.2 with 12. If beta version does not work, gives too much trouble or is just unpleasant:  How do we downgrade to an official stable version, currently Safari 11.1.2 for 10.12.6 Sierra?  I tried to restore everything relating to 11.1.2 from a backup (going by what is found that is in the installer package), I located and re-applied the 11.1.2_Sierra.pkg. Yet Safari now refuses to work entirely.   Crashed Thread:        3  Dispatch queue: com.apple.SafariCore.RemotePlistController.internalQueue  Exception Type:        EXC_CRASH (SIGABRT) Exception Codes:       0x0000000000000000, 0x0000000000000000 Exception Note:        EXC_CORPSE_NOTIFY  Application Specific Information: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[_NSPlaceholderData initWithContentsOfURL:options:error:]: nil URL argument' terminating with uncaught exception of type NSException abort() called   Is there any way around re-installing the entire system? How to get the caret column (not pixels) position in a textarea, in characters, from the start? How do you get the caret position in a &lt;textarea&gt; using JavaScript?  For example: This is| a text  This should return 7.  How would you get it to return the strings surrounding the cursor / selection?  E.g.: 'This is', '', ' a text'.  If the word “is” is highlighted, then it would return 'This ', 'is', ' a text'. Adding admin-ajax.php to the frontend. Good or bad idea? I love admin-ajax.php. But I hate having to localize in order to point frontend scripts to it, and I wish there was an equivalent, easy-to-find file for themes. (It also just bothers me to see frontend requests go through "/wp-admin/". No practical reason, just looks ugly IMO.)  So I've simply copied admin-ajax.php to the root dir at "/ajax.php", adjusted the include paths and removed the WP_ADMIN constant definition. Seems to work like gangbusters (I can now just direct all my frontend AJAX requests to /ajax.php! And I can still use the normal wp_ajax hooks in my plugins!).  But is this safe? What might go wrong? Since this isn't built into core, I assume there's a good reason as to why not. But looking through the code, I can't see any immediate problems.   You're smart--tell me if this approach is crazy. Or if there's a simpler method that I'm overlooking. find the measure of $AMC$ if $M$ is the midpoint of $BC$ then find the measure of $AMC$.    I tried to use the angles to find $AMC$ but I don't know how to use that $M$ is the midpoint of $BC$. Suppose $\sum{a_n}$ converges. How do I prove that $\sum{\frac{\sqrt{a_n}}{n}}$ converges.  So I know that just because  $\sum{a_n}$ converges, do not mean I can say anything about the converges of its square root. So I know that I can prove that if  $\sum{\sqrt{a_n}}$ converges then $\sum{\frac{\sqrt{a_n}}{n}}$ converges by Abel's Test, but I do not know where to start for the case where  $\sum{\frac{\sqrt{a_n}}{n}}$ diverges When can a sum and integral be interchanged? Let's say I have $\int_{0}^{\infty}\sum_{n = 0}^{\infty} f_{n}(x)\, dx$ with $f_{n}(x)$ being continuous functions. When can we interchange the integral and summation? Is $f_{n}(x) \geq 0$ for all $x$ and for all $n$ sufficient? How about when $\sum f_{n}(x)$ converges absolutely? If so why? Word for dismissing someone's opinions as racist, liberal, etc, instead of debating back I'm looking for either a single word or phrase that would describe either someone or the action of dismissing someone's opinions as something "socially unpopular", without giving any reasoning why, either just to spite them, because they have a poor counter-argument, have been backed into a corner, or something similar.  For example, someone who supports something politically incorrect (like, say, stronger gun control or help for male domestic abuse) might have their views dismissed as racist or sexist or liberal without actually acknowledging and debating against them, thus labeling the former as something they might not be.  I was talking to a friend earlier about politics, and she complained about Germany's immigration problem. She said one issue was that many politicians that try to support stronger immigration laws would immediately be shot down as racist or a nazi and forced to resign, instead of being presented with counter-arguments. Regardless of whether you agree with them or not, what would describe that?  EDIT: Forgot to specify -- the word or phrase I'm looking for would be used in an informal context. And to address further questions, to be used when the person's opinion has legitimate worth and isn't just "being racist" etc, i.e. the dismisser is incorrect, and is only making these accusations because they can't argue further. (Added emphasis to the last sentence of the first paragraph) How to override 'DefWndProc' in WPF Filling only when one curve is below the other The muffins were rock hard, what did I do wrong? Word for describing in a positive sense What is a word that means to say in a positive sense? For instance, when writers say that a person was sexually assaulted instead of saying raped.  Or people use let go instead of fired.  What is that called? Is there any reason to use this-> I am programming in C++ for many years, still I have doubt about one thing. In many places in other people code I see something like:  void Classx::memberfunction() {     this-&gt;doSomething(); }   If I need to import/use that code, I simply remove the this-> part, and I have never seen anything broken or having some side-effects.  void Classx::memberfunction() {     doSomething(); }   So, do you know of any reason to use such construct?  EDIT: Please note that I'm talking about member functions here, not variables. I understand it can be used when you want to make a distinction between a member variable and function parameter.  EDIT: apparent duplicate: Is there a such thing as an exchange program in Harry Potter? In the Harry Potter universe, is there any mention of an exchange student at Hogwarts or one of the Hogwarts students going on exchange at another school?  This happens all the time in the "muggle" school systems I'm sure it would happen in the wizarding schools as well. Can 'AMD-only' RAM really be restricted to AMD chipsets, and if so, why? Strange OutOfMemory issue while loading an image to a Bitmap object How to convert from one grading scheme to another? Completion of rational numbers via Cauchy sequences Can anyone recommend a good self-contained reference for completion of rationals to get reals using Cauchy sequences? What possessive forms are used for mutual 1st person ownership? I want to talk to someone about the house that my wife and I own.  Saying, for example, "My wife's and my house is awesome," sounds a bit funny to me.  What's the best way to express this?  Clarification  I'm asking specifically about the grammar of multiple nouns in possessive form.  I'm particularly curious if it's possible to do this with a first-person pronoun (me).  I am capable of rephrasing this in other ways - my question is not how to express the idea, but about this particular grammatical construction, if it is even legal. How to multiply a BigDecimal by an integer in Java Anti-Matter Black Holes Assuming for a second that there were a pocket of anti matter somewhere sufficiently large to form all the type of object we can see forming from normal matter - then one of these objects would be a black hole.  Question is, would there be a difference between an anti matter black hole and a normal matter black hole - in terms of how would the matter/anti-matter make the black hole different, or would they be the same?  I would expect the answer to be that the black hole formed from anti matter would retain the anti-matter properties in such a way that if it was to merge with a black hole at same size formed from normal matter that they would annihilate  each other con convert into pure energy - Would that be a correct understanding?