Type-juggling and (strict) greater/lesser-than comparisons in PHP

PHP’s comparison operators deviate from the computer-scientific definitions in several ways: In order to constitute an equivalence relation == has to be reflexive, symmetric and transitive: PHP’s == operator is not reflexive, i.e. $a == $a is not always true: var_dump(NAN == NAN); // bool(false) Note: The fact that any comparison involving NAN is always … Read more

Most efficient way of making an if-elif-elif-else statement when the else is done the most?

The code… options.get(something, doThisMostOfTheTime)() …looks like it ought to be faster, but it’s actually slower than the if … elif … else construct, because it has to call a function, which can be a significant performance overhead in a tight loop. Consider these examples… 1.py something = ‘something’ for i in xrange(1000000): if something == … Read more

Is “IF” expensive?

At the very lowest level (in the hardware), yes, ifs are expensive. In order to understand why, you have to understand how pipelines work. The current instruction to be executed is stored in something typically called the instruction pointer (IP) or program counter (PC); these terms are synonymous, but different terms are used with different … Read more

How to use if-else condition on gitlabci

Hereunder three syntax options for that kind of statement. From gitlab-ci documentation : Using shell variable deploy-dev: image: testimage environment: dev tags: – kubectl script: – if [ “$flag” == “true” ]; then MODULE=”demo1″; else MODULE=”demo2″; fi – kubectl apply -f ${MODULE} –record=true Using shell variable with yaml multiline block deploy-dev: image: testimage environment: dev … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)