0

What do you guys prefer? And Why? And what is more readable?

public const MAX_FILE_SIZE_BYTES = 10485760; // 10 MB in Bytes

VS

public const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10mb

Both ways result in the same. Feel free to share your opinion :)

Oliver
  • 51
  • 1
  • 7
  • *This question is likely to be answered with opinions rather than facts and citations.* - it's a matter of style and not really anything more (IMHO). – Nigel Ren Dec 28 '21 at 09:01
  • Yeah, i want some opinions, but facts and citations are ok also. – Oliver Dec 28 '21 at 09:02
  • Your question appears to be subjective. The way I remember this, is that StackOverflow is intended for questions that has a solution. I would suggest that you read this: [Avoid asking these types questions](https://stackoverflow.com/help/dont-ask). And possibly read further here: [Help Center](https://stackoverflow.com/help). ... I know this seems strict, but I've experienced, that if you stay within these guidelines, and rephrase questions to follow them, then you can get an enormous amount of help in here. ... Please edit your question and write what you're trying to optimize for. – Zeth Dec 28 '21 at 09:06

1 Answers1

1

I prefer this :

public const MAX_FILE_SIZE = 10_000_000; // 10 MB (PHP 7.4)

Or, because 10485760 doesn't mean anything to me :

public const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10 MiB

For a file size "_BYTES" is implied.

JCH77
  • 1,125
  • 13
  • 13