1--TEST-- 2Test -N operator : various numbers as strings 3--FILE-- 4<?php 5 6$strVals = array( 7 "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a", 8 "a5.9" 9); 10 11 12foreach ($strVals as $strVal) { 13 echo "--- testing: '$strVal' ---\n"; 14 var_dump(-$strVal); 15} 16 17?> 18===DONE=== 19--EXPECTF-- 20--- testing: '0' --- 21int(0) 22--- testing: '65' --- 23int(-65) 24--- testing: '-44' --- 25int(44) 26--- testing: '1.2' --- 27float(-1.2) 28--- testing: '-7.7' --- 29float(7.7) 30--- testing: 'abc' --- 31 32Warning: A non-numeric value encountered in %s on line %d 33int(0) 34--- testing: '123abc' --- 35 36Notice: A non well formed numeric value encountered in %s on line %d 37int(-123) 38--- testing: '123e5' --- 39float(-12300000) 40--- testing: '123e5xyz' --- 41 42Notice: A non well formed numeric value encountered in %s on line %d 43float(-12300000) 44--- testing: ' 123abc' --- 45 46Notice: A non well formed numeric value encountered in %s on line %d 47int(-123) 48--- testing: '123 abc' --- 49 50Notice: A non well formed numeric value encountered in %s on line %d 51int(-123) 52--- testing: '123abc ' --- 53 54Notice: A non well formed numeric value encountered in %s on line %d 55int(-123) 56--- testing: '3.4a' --- 57 58Notice: A non well formed numeric value encountered in %s on line %d 59float(-3.4) 60--- testing: 'a5.9' --- 61 62Warning: A non-numeric value encountered in %s on line %d 63int(0) 64===DONE=== 65