<?php//Naming convention$first_name='Mike'.// all lower case with underscore separatorsfunctionupdateProduct()// camelCaseclassProductItem// StudlyCapsconstACCESS_KEY='123abc';// all upper case with underscore separators//outputecho'Hello World';//variable declaration$name='Mike';//string$isActive=true;//boolean$number=25;//integer$amount=99.95;//float...
You seem to introduce a naming convention of camel case for var names, then immediately contradict it with $isActive?
Businessman and blogger #Javascript, #Python and #PHP. My favorite frameworks/librairies are #React, #Laravel, and #Django. I am also a fan of #TailwindCSS
Businessman and blogger #Javascript, #Python and #PHP. My favorite frameworks/librairies are #React, #Laravel, and #Django. I am also a fan of #TailwindCSS
I share knowledge on: - Full Stack Development with PHP, Python, Javascript, Django, Laravel, Vue - Software Architecture and Large-Scale System Design - System Administration Web: lakhveerbawa.com
I need to benchmark it again, but ++$i is a micro optimizion you can use on your for loops. IIRC, do..while is another micro optimization you replace your while loops with, if you can guarantee at least one iteration.
Businessman and blogger #Javascript, #Python and #PHP. My favorite frameworks/librairies are #React, #Laravel, and #Django. I am also a fan of #TailwindCSS
I am a professional DevOps Engineer with a demonstrated history of working in the internet industry. I am an avid Linux lover and supporter of the open-source movement philosophy.
25+ years developer, starting with Basic for Sinclair and then Turbo Pascal from Borland. Excited to find new solutions and technologies. Crying with emotion when I see a new algorythm invented.
More of a style thing, but for booleans I try to give them a verb name like:
which I’ve found makes my code read more semantically when the variables are used in conditional statements and loops
You seem to introduce a naming convention of camel case for var names, then immediately contradict it with
$isActive
?Good point :-)
Oh come on, where is PHP8 features?
Good point. Will add those later today.
Pretty good work, I am not sure, if it's only me, I must have used "while and do-while loop" no more than 2-3 times in the last 4 years
I need to benchmark it again, but ++$i is a micro optimizion you can use on your for loops. IIRC, do..while is another micro optimization you replace your while loops with, if you can guarantee at least one iteration.
Nice list. Note: In at least 2 cases you use
__construc
where it should be__construct
Good catch. Corrected.
That is great! I recently wrote a similar PHP guide here.
Wow this is great. Weldone
Very very useful and concise. Do you have it as a 1 or 2 pages PDF?