3
I’m studying PHP and came across a Feature which does not exist in Python (I do not know in other languages), which is the assignment in a conditional test:
$file = fopen("arquivo.txt", "w");
while($row = fgets($file)){
    ...
}
Correct me if I’m wrong but in a conditional test, the same search check the result of the condition or the state of the object for example an empty list is false, what we call Truthy and Falsey in Javascript. My doubts are:
- That one Feature exists only in PHP?
- How does it work underneath the covers?
What are Python Assignment Expressions 3.8?
– Woss
This is an inline assignment, it has nothing to do with parole. See an example:
$a = 30 + ($b = 10) * 5;https://ideone.com/OOOxds– Bacco