<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog de Thomas ZILLIOX &#187; PHP</title>
	<atom:link href="https://blog.developpez.com/thomas-zilliox/pcategory/web/php/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.developpez.com/thomas-zilliox</link>
	<description></description>
	<lastBuildDate>Tue, 07 Aug 2012 17:24:03 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>Afficher les erreurs PHP</title>
		<link>https://blog.developpez.com/thomas-zilliox/p11105/web/afficher_les_erreurs_php</link>
		<comments>https://blog.developpez.com/thomas-zilliox/p11105/web/afficher_les_erreurs_php#comments</comments>
		<pubDate>Wed, 20 Jun 2012 15:40:18 +0000</pubDate>
		<dc:creator><![CDATA[tzilliox]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Il existe une propriété dans php.ini pour indiquer le niveau d&#8217;affichage des erreurs et alertes. De nombreuses installations de PHP n&#8217;affichent pas les erreurs ou pas toutes. En effet, cela peut causer des problèmes. Par exemple, il n&#8217;est pas possible de faire header() s&#8217;il y a déjà eu une sortie écran. Notamment, cela peut vous bloquer les redirections. Les alertes peuvent aussi donner un peu trop d&#8217;indications à un éventuel hacker Néanmoins, il souvent très [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Il existe une propriété dans php.ini pour indiquer le niveau d&rsquo;affichage des erreurs et alertes.<br />
De nombreuses installations de PHP n&rsquo;affichent pas les erreurs ou pas toutes.</p>
<p>En effet, cela peut causer des problèmes. Par exemple, il n&rsquo;est pas possible de faire header() s&rsquo;il y a déjà eu une sortie écran. Notamment, cela peut vous bloquer les redirections. Les alertes peuvent aussi donner un peu trop d&rsquo;indications à un éventuel hacker <img src="https://blog.developpez.com/thomas-zilliox/wp-includes/images/smilies/icon_wink.gif" alt=";)" class="wp-smiley" /></p>
<p>Néanmoins, il souvent très pratique en période de développement d&rsquo;afficher ces erreurs.<br />
Vous pouvez le faire directement en PHP :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">error_reporting( E_ALL | E_STRICT );<br />
ini_set( 'display_errors', '1' );</div></div>
<p>J&rsquo;utilise le niveau E_STRICT et E_ALL. En effet, avant PHP 5.4, E_ALL ne contient pas les alertes de niveau E_STRICT.</p>
<p>C&rsquo;est à faire absolument, lorsque votre code génère une page blanche et que vous n&rsquo;avez pas accès aux logs.</p>
<p>En espérant que ça puisse vous aider,<br />
Thomas.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Formater et déformater un nombre en PHP</title>
		<link>https://blog.developpez.com/thomas-zilliox/p9244/web/formater_un_nombre_en_php</link>
		<comments>https://blog.developpez.com/thomas-zilliox/p9244/web/formater_un_nombre_en_php#comments</comments>
		<pubDate>Wed, 01 Sep 2010 08:46:12 +0000</pubDate>
		<dc:creator><![CDATA[tzilliox]]></dc:creator>
				<category><![CDATA[Function List]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Connaissez-vous la fonction PHP number_format() ? Depuis PHP4, elle est très utile pour présenter de grands nombres de façon lisible. Voici un exemple pour afficher un nombre à 7 chiffres avec un format français : &#60;?php // Le nombre non-formaté : 1234567.89123 $number = 1234567.89123; echo $number; // Le nombre formaté : 1 234 567,89 $string = number_format($number, 2, ',', ' '); echo $string; ?&#62; La méthode number_unformat() n&#8217;existe pas. Elle aurait pu être pratique [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Connaissez-vous la fonction PHP <strong>number_format()</strong>  ?<br />
<span id="more-6"></span><br />
Depuis PHP4, elle est très utile pour présenter de grands nombres de façon lisible.<br />
Voici un exemple pour afficher un nombre à 7 chiffres avec un format français :</p>
<pre style="background-color:#E0E0E0;border:1px #cccccc solid;padding:10px">
<span style="color:#CC3333;">&lt;?php</span>
 
<span style="color:#669933;font-style:italic;">// Le nombre non-formaté : 1234567.89123</span>
<span style="font-family:monospace;">$number</span> <span class="o">=</span> <span class="m">1234567.89123</span><span class="p">;</span> 
<span style="color:#0033CC;">echo</span> <span style="font-family:monospace;">$number</span><span class="p">;</span> 
 
<span style="color:#669933;font-style:italic;">// Le nombre formaté : 1 234 567,89</span>
<span style="font-family:monospace;">$string</span> <span class="o">=</span> <span style="color:#00AAAA;">number_format</span><span class="p">(</span><span style="font-family:monospace;">$number</span><span class="p">,</span> <span class="m">2</span><span class="p">,</span> <span class="s1">','</span><span class="p">,</span> <span class="s1">' '</span><span class="p">);</span> 
<span style="color:#0033CC;">echo</span> <span style="font-family:monospace;">$string</span><span class="p">;</span> 
<span style="color:#CC3333;">?&gt;</span>
</pre>
<p>La méthode <strong>number_unformat()</strong> n&rsquo;existe pas. Elle aurait pu être pratique pour autoriser les visiteurs à utiliser un format plus instinctif pour les grands nombres. Voici un exemple d&rsquo;implémentation de la méthode <strong>number_unformat()</strong> :</p>
<pre style="background-color:#E0E0E0;border:1px #cccccc solid;padding:10px">
<span style="color:#CC3333;">&lt;?php</span>

<span style="color:#669933;font-style:italic;">// La méthode inverse</span>
<span style="color:#0033CC;">function</span> <span class="nf">number_unformat</span><span class="p">(</span><span style="font-family:monospace;">$string</span><span class="p">,</span> <span style="font-family:monospace;">$dec_point</span><span class="p">,</span> <span style="font-family:monospace;">$thousands_sep</span><span class="p">)</span> <span class="p">{</span>
  <span style="color:#0033CC;">return</span> <span style="color:#00AAAA;">floatval</span><span class="p">(</span><span style="color:#00AAAA;">str_replace</span><span class="p">(</span><span style="color:#0033CC;">array</span><span class="p">(</span><span style="font-family:monospace;">$dec_point</span><span class="p">,</span> <span style="font-family:monospace;">$thousands_sep</span><span class="p">),</span> <span style="color:#0033CC;">array</span><span class="p">(</span><span class="s1">'.'</span><span class="p">,</span> <span class="s1">''</span><span class="p">),</span> <span style="font-family:monospace;">$string</span><span class="p">));</span>
<span class="p">}</span>

<span style="color:#669933;font-style:italic;">// Le nombre déformaté : 1234567.89</span>
<span style="color:#0033CC;">echo</span> <span style="color:#CC9933;">number_unformat</span><span class="p">(</span><span style="font-family:monospace;">$string</span><span class="p">,</span> <span class="s1">','</span><span class="p">,</span> <span class="s1">' '</span><span class="p">)</span><span class="p">;</span>

<span style="color:#CC3333;">?&gt;</span>
</pre>
<p>Bonne journée,<br />
Thomas.</p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
