# Sugest

- Thread: https://externals.io/message/48287
- Original archive: https://news-web.php.net/php.internals/48287
- Started by Mathias Grimm on 2010-05-13T23:38:47+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #48287 — Mathias Grimm — 2010-05-13T23:38:47+00:00

URL: https://externals.io/message/48287#48287

I want to suggest the GO include format

<?php
require
(
    'utila.php',
    'utilb.php',
    'utilc.php',
)

the same from include

or more , without comma

<?php

require
(
    'utila.php'
    'utilb.php'
    'utilc.php'
)

or more, withou .php
<?php

require
(
    'utila',
    'utilb',
    'utilc',
)


the same for other to, like define..

<?php
define
(
    'K_TYPE_A' => 'a',
    'K_TYPE_B' => 'b'
    'K_TYPE_C' => 'c'
)

with or withou comma...



-- 
Att.
Mathias Grimm

http://mathiasgrimm.com.br
http://phpempregos.com.br

---

## #48291 — johannes@schlueters.de — 2010-05-14T12:53:54+00:00

URL: https://externals.io/message/48287#48291 · In reply to: #48287

> I want to suggest the GO include format
> 
> <?php
> require
> (
>     'utila.php',
>     'utilb.php',
>     'utilc.php',
> )
> 
> the same from include

What's te benefit, other than saving a few chars on the cost of being
more explicit. I don't see any benefit.

Doing this would mean an error to include one of these files would give
an imprecise error message. Given

<?php
require(
    $a,
    $b
);
?>

fails it will always tell you about an error in line 5 (basically where
the ; is)

<?php
require $a;
require $b;
?>

will give you the precise line.

Other similar issues exist.

> or more , without comma
> 
> <?php
> 
> require
> (
>     'utila.php'
>     'utilb.php'
>     'utilc.php'
> )

that looks more like a typo than expected code.

> or more, withou .php
> <?php
> 
> require
> (
>     'utila',
>     'utilb',
>     'utilc',
> )

that makes no sense. It would have to check for two files, and why
only .php? Why not .inc or .class or whatever people are using?

> 
> the same for other to, like define..
> 
> <?php
> define
> (
>     'K_TYPE_A' => 'a',
>     'K_TYPE_B' => 'b'
>     'K_TYPE_C' => 'c'
> )
> 
> with or without comma...

 `define()` is a regular function so we'd have to make it a language
construct (which creates issues) or do some strange things to function
declarations.

Again, I see no benefit (and no, a few characters more are no trouble,
writing code is never the hard part. The hard part is maintenance ...
and a proper IDE serves quite well for saving key strokes ...)

johannes

---

## #48294 — Mathias Grimm — 2010-05-14T14:41:35+00:00

URL: https://externals.io/message/48287#48294

>
> > […]
> Less characters doesn't make anything more productive. Saving the few
> characters might save a second while typing, but the additional keyword
> makes ready cleaner. A line of code is read way more often than typed.
>
>
>
define
(
  'a'=>1
  'b'=>2
  'c'=>3
)

its cleaner to me. like C ENUM.


enum DAY            /* Defines an enumeration type    */

{
    saturday,       /* Names day and declares a       */
    sunday = 0,     /* variable named workday with    */
    monday,         /* that type                      */
    tuesday,
    wednesday,      /* wednesday is associated with 3 */
    thursday,
    friday
} workday;


it is cleaner for everyone.
maybe the enum type could even be created for this.



> > […]
>
> Yes. So we should make it worse since it isn't perfect in one place?
>

there are fixes to be the error line be precise.


>
> > […]
>
> That's wrong.
>
> > […]
>
> That breaks tons of code. and just makes life harder.
>
>
>
ok, maybe its not the best ideia.



> > […]
>
> If you talk about being productive you use tools which make you
> productive.
>
> im talking about more productive. evoltion of produtivity



> > […]
>
> So we should rename all functions,too? mysql_query() is long, mq()
> should work well?
>
> no, isnt a rename..
its a new constructor of php.

mq is ambiguos, but require(..,..,..),define(..,..,..) its cleaner, not a
rename.



> > […]
>
> no. That's Perl, and Perl is known as unreadable write-only language.
>
> johannes
>
>
require(...,..,..),define(...,...) dont make php harder to read and make
easy to write.


-- 
Att.
Mathias Grimm

http://mathiasgrimm.com.br
http://phpempregos.com.br

---

## #48295 — Arvids Godjuks — 2010-05-14T15:21:57+00:00

URL: https://externals.io/message/48287#48295 · In reply to: #48294

2010/5/14 Mathias Grimm <mathiasgrimm@gmail.com>:
> > […]

There is one thing you don't take into account.
Make an index.php and all other files .inc. Than add to web servers
configuration a deny rule for *.inc . Suddenly you improved your
security dramatically because there is only one access point for the
whole project. I use this 100% every time.
