Good vs. Evil

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
53 so.... I discovered another feature of php
Code:
$test = `ls -al`;
this is the same as doing
Code:
$test = shell_exec("ls -al");
also, this being php we can
Code:
$options = "-al";
$test = `ls {$options}`
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
52 Looks like a good way to write unmaintainable code.
53 I don't mind being able to put variables directly into strings, even if I don't use it myself. There are more languages that allow you to do that.
However, the fact that someone found it necessary to make it that easy to execute shell commands is....weird....
 

duckfan77

Popular Member
Mar 18, 2013
80
683
118
54 I was referring to mixing all of them together. It's like using int[] a[]; to define a 2 dimensional array.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
54 I was referring to mixing all of them together. It's like using int[] a[]; to define a 2 dimensional array.
55 if you truly want to write unmaintainable code you should use the fact that php may not care about capitalization when setting constants. Thus you can effectively overwrite them in certain cases.
https://3v4l.org/rAKrH
also, constants are always either global or bound to a class. You can't have local constants. Which effectively limits them to configuration stuff, so being able to overwrite them is even worse.