Very simple question, is it possible to use a smarty var inside the {php}{/php} tags. I know it’s deprecated, pointless, not recommended, etc., but please, I am looking for a simple patch ! Something …
Test if a regular expression is a valid one in PHP
I am writing a form validation class and wish to include regular expressions in the validation. Therefore, the regex provided isn’t guaranteed to be valid. How can I (efficiently) check that the …
Add namespace Prefix in Nusoap PHP
I’m using nusoap v 1.123, I’m trying to add the prefixes urn in my generated request of nusoap This is what I am expecting <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/…
Remove Same Character once from two different string
I need help in PHP Script. I have two strings. After removing the same character from both string once, Another Two Strings example Output I tried str_replace which replace all the all the characters. Thanks for your helps Answer
Transpose 2d array, join second level with commas, and join first level with pipes
I have the following two-dimensional array: I want to convert columns to rows then reduce the matrix to a string like the following: Answer I’m assuming that you have this array: In which case, you can do this: See it working
PHP: Append to thrown exception message
Take the following function as an example of what I want to do: public function save() { $this->connect(‘wb’); try { if(!$this->lock()) throw new Exception(“Unable …
Regex to find content of the last occurence of square brackets
Hi Everybody, I’m Currently using preg_match and I’m trying to extract some informations enclosed in square brackets. So far, I have used this: /[(.*)]/ But I want it to be only the content of the last occurence – or the first one, if starting from the end! In the following: string = “…
Getting META description via jQuery
Let’s say I do a simple AJAX request (in jQuery) like geturl.php?url=http://google.com and geturl.php is this: <?php if($_GET['url']) { $url=$_GET['url']; echo …
How to find the Dominant color in image?
i want to find the dominant color in image, how can i do it ? it would be great if i can get this in HEX code (exm: #eeeeee)
iconv – Detected an illegal character in input string
I don’t see anything illegal – any suggestions on what might be the problem? if (strtolower($matches[1]) != ‘utf-8’) { var_dump($matches[1]); $xml = iconv($matches[1], ‘utf-8’, $…