Monthly Archives: August 2010

PHP: What is More Powerful Than list() – Perhaps extract()

list() in PHP Recently I wrote about list() in PHP which is indeed very powerful when assigning variable values from array elements. $a = array(10, array(’here’, ‘are’, ‘some’, ‘tests’)); list($count, $list) = $a; Actually my example in the post was … Continue reading

Posted in micro tutorial, PHP | Tagged , , , , , , , , , | 1 Comment

Beginning Algorithm Complexity and Estimation

Which is the Fastest Program? When a programmer sees a chunk of code he tends to evaluate it in a rather intuitive manner and to qualify it as “elegant” or not. This is quite easy, because it’s subjective and nobody … Continue reading

Posted in micro tutorial, PHP | Tagged , , , , , , , , , , , , , , , , , | Leave a comment

PHP: What is More Powerful Than list()

First of all list() is not an unknown method in the PHP community, where almost every PHP developer knows what it does. The pity is that it has, perhaps, remained useless, although there is hidden power in it! What is … Continue reading

Posted in micro tutorial, PHP | Tagged , , , , , , , , , , , , , , , | 6 Comments

JavaScript Flexibility – Regex match()

Today after two posts [#1, #2] in the past days here’s something that shows again the JavaScript power. This is not a complete example, but it’s good to start. var str = ‘/text/1/text/2/’; var a = str.match(/(\d+)/gi); console.log(a); in that … Continue reading

Posted in javascript, micro tutorial | Tagged , , , , , , | Leave a comment

Flexible JavaScript – Replace in a String

Here’s yet another example of the JavaScript flexibility. You can simply call .replace() on every string and pass a regex as a parameter! var str = ‘my simple string’; str.replace(/ /g, ‘-’); // now ‘str’ will contain ‘my-simple-string’

Posted in web development | Tagged , , , , , , , , , , , | Leave a comment