Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Mit Php überprüfen ob eine Zahl positiv ist!!!

Empfohlene Antworten

Veröffentlicht

Hallo Leute,

weiß einer von euch, wie ich mittels Php überprüfen kann, ob eine Zahl positiv oder negativ ist?

Danke schon mal für die Vorschläge und Lösungen.


if ( $zahl > 0 ) {
echo "positiv";
} else {
echo "negativ";
}
[/PHP]

Gruß,

Markus

Danke :uli

:confused: :confused: ... aha .. :floet:

darauf hätt ich auch eigentlich selber kommen können!!!

ich dachte nur da gibts etwas vordefiniertes wie zb:

is_int_positive ($zahl) oder sowas in der art...


if ( $zahl > 0 ) {
echo "positiv";
} else {
echo "negativ";
}
[/PHP]

Gruß,

Markus

Demnach wäre 0 aber eine negative Zahl. ;)

Nein, danach wäre Null ja eine positive Zahl ;) Mathematisch gesehen ist ein

return $zahl > 0;

richtig. Dann meldet die Funktion korrekt zurück das 0 nicht positiv ist (zwar auch nicht negativ, aber es soll ja nur bei explizit positiven Zahlen true kommen...) ;)

*reicht mal ein paar Haare zum spalten rum*

*reicht mal ein paar Haare zum spalten rum*

Da brauchste keine Haare rumgeben.

Du bist der gleichen Meinung wie ich und somit passt das :cool:

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.