Businessman and blogger #Javascript, #Python and #PHP. My favorite frameworks/librairies are #React, #Laravel, and #Django. I am also a fan of #TailwindCSS
<?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
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.
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
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
Oh come on, where is PHP8 features?
Good point. Will add those later today.
You seem to introduce a naming convention of camel case for var names, then immediately contradict it with
$isActive?Good point :-)
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.
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
Nice list. Note: In at least 2 cases you use
__construcwhere it should be__constructGood 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?