Is This PHP or Python? I'm Not Sure Anymore... #php #shorts

preview_player
Показать описание
This YouTube Short will show you that you can write PHP code that looks like Python code! Did you know that you could remove curly braces from your conditional statements in PHP?

📲 Let’s plan a meeting
Plan a (paid) 1-hour meeting on Calendly to do portfolio reviews, code reviews resume reviews or a coaching session for Laravel

💌 Newsletter
Sign up for my free weekly email newsletter

🔥 Resources

#shorts #laravel #php
Рекомендации по теме
Комментарии
Автор

Here is a shorter one:

$input === $language ? echo 'Equal' : echo 'Not Equal';

drawndown
Автор

Well I knew this way, but it only works with one statement. But don't fret, there is _another_ way to skip curly braces, just use the : syntax
<?php
if ($a == 5):
echo "a equals 5";
echo "...";
elseif ($a == 6):
echo "a equals 6";
echo "!!!";
else:
echo "a is neither 5 nor 6";
endif;
?>

furomin
Автор

Phpstorm wants me to add braces everywhere so I always use curly braces

gamenation
Автор

Btw this is not recommended by php coding standarts

armandarmesh
Автор

and after that, if you're using phpstorm, press ctrl+alt+L.
Thank me later

chriram