Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > de.comp.lang.javascript > #4880

Re: Warum funktioniert das nicht (Variable aus DB> JS)

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups de.comp.lang.javascript
Subject Re: Warum funktioniert das nicht (Variable aus DB> JS)
Date 2017-06-27 11:30 +0200
Organization PointedEars Software (PES)
Message-ID <2593417.VdNmn5OnKV@PointedEars.de> (permalink)
References <oir0uu$h9h$1@news.albasani.net> <oit0iv$4po$1@news.albasani.net>

Show all headers | View raw


Gerome Muent wrote:

> Falsch:
> var
> df=Carbon\Carbon::now()-
>format(\App\Setting::getSettingFor("DATE_FORMAT"));
> 
> 
> Richtig :
> var df=<?php
> echo Carbon\Carbon::now()
>       ->format(\App\Setting::getSettingFor("DATE_FORMAT")); ?>;

Wie Christoph gestern schon schrieb: Korrekt ist dann

  var df = "<?= … ?>";

Denn ein PHP-String ist nicht automatisch ein ECMAScript-String – die 
String-Begrenzer sind daher in ECMAScript erforderlich – und die 
short_open_tag-Syntax ist seit PHP 5.4 (ab der sie nicht länger von der 
gleichnamigen Einstellung abhängt) zu bevorzugen:

<http://php.net/manual/en/ini.core.php#ini.short-open-tag>

PHP 5.4.0 wurde übrigens am 1. März *2012* released und hat bereits *vor 
über einem Jahr* sein End-of-Life erreicht:

<http://php.net/eol.php>

Die aktuellen stabilen Versionen sind 5.6.30, 7.0.20 und 7.1.6:

<http://php.net/>
<http://php.net/supported-versions.php>

Jetzt haben wir Mitte *2017*.  Ich empfehle daher *dringend*, das eigene
PHP-Wissen mal wieder aufzufrischen und auch die Software upzugraden.

-- 
PointedEars (ZCE PHP)

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to de.comp.lang.javascript | Previous | NextPrevious in thread | Find similar


Thread

Warum funktioniert das nicht (Variable aus DB> JS) Jan Novak <bforpc@yahoo.de> - 2017-06-26 15:07 +0200
  Re: Warum funktioniert das nicht (Variable aus DB> JS) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-06-26 15:11 +0200
    Re: Warum funktioniert das nicht (Variable aus DB> JS) "Christoph M. Becker" <cmbecker69@arcor.de> - 2017-06-26 15:26 +0200
      Re: Warum funktioniert das nicht (Variable aus DB> JS) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-06-26 15:32 +0200
        Re: Warum funktioniert das nicht (Variable aus DB> JS) "Christoph M. Becker" <cmbecker69@arcor.de> - 2017-06-26 15:52 +0200
          Re: Warum funktioniert das nicht (Variable aus DB> JS) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-06-27 07:07 +0200
          Re: Warum funktioniert das nicht (Variable aus DB> JS) Jan Novak <repcom@gmail.com> - 2017-06-27 14:54 +0200
            Re: Warum funktioniert das nicht (Variable aus DB> JS) "Christoph M. Becker" <cmbecker69@arcor.de> - 2017-06-27 15:54 +0200
              Re: Warum funktioniert das nicht (Variable aus DB> JS) Jan Novak <repcom@gmail.com> - 2017-06-27 19:35 +0200
                Re: Warum funktioniert das nicht (Variable aus DB> JS) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-06-28 19:30 +0200
                Re: Warum funktioniert das nicht (Variable aus DB> JS) Jan Novak <repcom@gmail.com> - 2017-06-29 17:20 +0200
                OT: Editor (war: Warum funktioniert das nicht (Variable aus DB> JS)) Jan Novak <repcom@gmail.com> - 2017-06-29 20:28 +0200
                Re: OT: Editor Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-06-30 01:51 +0200
                Re: OT: Editor Jan Novak <repcom@gmail.com> - 2017-06-30 09:14 +0200
                Re: OT: Editor Jan Novak <repcom@gmail.com> - 2017-06-30 10:08 +0200
                Re: OT: Editor Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-06-30 16:51 +0200
                Programmierung mit Atom (was: OT: Editor) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-09-11 19:05 +0200
  Re: Warum funktioniert das nicht (Variable aus DB> JS) Gerome Muent <kontakt@bmservices.de> - 2017-06-27 09:13 +0200
    Re: Warum funktioniert das nicht (Variable aus DB> JS) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-06-27 11:30 +0200

csiph-web