User Tools

Site Tools


kurs:php5

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

kurs:php5 [2014/09/10 21:22]
kurs:php5 [2014/09/10 21:22] (current)
Line 1: Line 1:
 +\\
 +**PrintF String formatieren**
  
 +<code php>
 +<?php
 +$preis = 5;
 +$steuer = 0.2;
 +printf(
 + "Der Preis incl. MwSt. = %.2f ¤", ​
 + $preis * (1 + $steuer)
 + );
 +?>
 +</​code>​\\
 +
 +<code php>
 +<?php
 +$plz = '​1140';​
 +$tag = 4;
 +$monat = 2;
 +$jahr = 2005;
 +
 +printf(
 + "die Postleitzahl= %05d und <br>
 + Datum = %05d.%02d.%d",​
 + $plz, $tag, $monat, $jahr);
 +
 +$min = -20;
 +$max = 40;
 +printf("<​br>​Der Motor kann von %+d bis %+d betrieben werden",​ $min, $max);
 +?>
 +</​code>​
kurs/php5.txt · Last modified: 2014/09/10 21:22 (external edit)