55274

why this code adds two point every time that executes

Question:

why this code every time that executes adds two point to <strong>number</strong> in <strong>a.txt</strong> :

<?php function substr_unicode($str, $s, $l = null) { return join("", array_slice( preg_split("//u", $str, -1, PREG_SPLIT_NO_EMPTY) , $s, $l) ); } function statusRead() { $statusfile = file_get_contents('a.txt'); // for detecting and removing BOM (0xEF,0xBB,0xBF) $statusfile = ord($statusfile[0]) == 239 ? ord($statusfile[1]) == 187 ? ord($statusfile[2]) == 191 ? substr_unicode($statusfile, 1) : $statusfile : $statusfile : $statusfile; $statusfile = str_replace("\r",'',$statusfile); $statusfile = explode("\n",$statusfile); foreach ($statusfile as $a) { $a = explode(":",$a); if($a[0]) $temp[$a[0]] = @$a[1] ? $a[1] : null; } return $temp; // changed: (($statusfile = $temp; return $statusfile;)) to ((return $temp;)) } function statusUpdate($data) { $temp = ''; foreach ($data as $a => $b) { $temp .= "$a:$b\r\n"; } file_put_contents('a.txt', $temp); } $a = statusRead(); $a['number']++; statusUpdate($a) ; ?>

this is content of <strong>a.txt</strong> :

stop:0 number:5 dor:3

a['number']++ every time adds two point to <strong>number</strong> in <strong>a.txt</strong> and when use a['number'] += 2 adds 4 points to <strong>number</strong> in <strong>a.txt</strong>

<strong>update:</strong> I changed $temp .= "$a:$b\r\n"; to $temp .= "$a :$b\r\n"; and my data saved in this structure:

stop :0 number :6 dor :3 number :1

but why?

Answer1:

finaly my problem solved.

I had two extensions on chrome which is cousing this problem.

<strong>1- Web Server Notifier</strong>

<strong>2- Web Technology Notifier</strong>

after disabling these two extensions my problem solved.

I found my answer from this page: <a href="https://stackoverflow.com/questions/6268516/php-mail-duplicates" rel="nofollow">php mail duplicates</a>

Recommend

  • why this code adds two point every time that executes
  • PHP preg_split with two delimiters and capture only one
  • PHP Get first 3 words from string
  • highlight only typed keywords from string in php
  • Splitting CSV, but not on comma only (PHP)? [closed]
  • PHP - Improve Regex (space and non-capturing group)
  • Compressing a string PHP [closed]
  • Formatting php for-loop
  • Handling results from MySQLi query after MySql to MySqli conversion
  • Explode at a varied whitespace?
  • How to Add post title to content description?
  • Need Help Optimizing php string difference function
  • Run ipconfig command with php
  • How to deal with m2m relationship(posts and tags) by doctrine(in symfony)?
  • Errors Installing Composer on macOS (JIT compilation Failed)
  • Splitting up html code tags and content
  • Split this values part of an insert query
  • Swift 2 SpriteKit issues
  • stream_context_set_params not works with ssh2.sftp wrapper
  • Pass javascript variable into php code
  • Delete cookie on browser close not on page refresh
  • Making a link stay active displaying hover effect upon click using javascript
  • file_get_Contents won't send query strings in url , thus receiving nothing with $_GET
  • PHP not converting JSON using 'json_decode()'
  • Helgrind for Windows?
  • Checking that one of multiple mandatory products categories are in cart
  • Zipping the contents of a folders in PHP
  • How to access list of email accounts with cPanel API?
  • Order ul list by span content
  • Creating new docker-machine instance always fails validating certs using openstack driver
  • Detection of framework usage on Mac system?
  • How to discover Font Type?
  • PHP Listener Script for Paypal Webhooks
  • java inputstream