Best Quick code snippet using to
is_executable_basic-win32-mb.phpt
Source:is_executable_basic-win32-mb.phpt
...13// create a file14$filename = __DIR__."/ç§ã¯ã¬ã©ã¹ãé£ã¹ããã¾ãis_executable.tmp";15create_file($filename);16$counter = 1;17/* loop to check if the file with new mode is executable18 using is_executable() */19for($mode = 0000; $mode <= 0777; $mode++) {20 echo "-- Changing mode of file to $mode --\n";21 chmod($filename, $mode); // change mode of file22 var_dump( is_executable($filename) );23 $counter++;24 clearstatcache();25}26// delete the temp file27delete_file($filename);28echo "Done\n";29?>30--EXPECT--31*** Testing is_executable(): basic functionality ***32-- Changing mode of file to 0 --33bool(false)34-- Changing mode of file to 1 --35bool(false)36-- Changing mode of file to 2 --37bool(false)38-- Changing mode of file to 3 --39bool(false)40-- Changing mode of file to 4 --41bool(false)42-- Changing mode of file to 5 --43bool(false)44-- Changing mode of file to 6 --45bool(false)46-- Changing mode of file to 7 --47bool(false)48-- Changing mode of file to 8 --49bool(false)50-- Changing mode of file to 9 --51bool(false)52-- Changing mode of file to 10 --53bool(false)54-- Changing mode of file to 11 --55bool(false)56-- Changing mode of file to 12 --57bool(false)58-- Changing mode of file to 13 --59bool(false)60-- Changing mode of file to 14 --61bool(false)62-- Changing mode of file to 15 --63bool(false)64-- Changing mode of file to 16 --65bool(false)66-- Changing mode of file to 17 --67bool(false)68-- Changing mode of file to 18 --69bool(false)70-- Changing mode of file to 19 --71bool(false)72-- Changing mode of file to 20 --73bool(false)74-- Changing mode of file to 21 --75bool(false)76-- Changing mode of file to 22 --77bool(false)78-- Changing mode of file to 23 --79bool(false)80-- Changing mode of file to 24 --81bool(false)82-- Changing mode of file to 25 --83bool(false)84-- Changing mode of file to 26 --85bool(false)86-- Changing mode of file to 27 --87bool(false)88-- Changing mode of file to 28 --89bool(false)90-- Changing mode of file to 29 --91bool(false)92-- Changing mode of file to 30 --93bool(false)94-- Changing mode of file to 31 --95bool(false)96-- Changing mode of file to 32 --97bool(false)98-- Changing mode of file to 33 --99bool(false)100-- Changing mode of file to 34 --101bool(false)102-- Changing mode of file to 35 --103bool(false)104-- Changing mode of file to 36 --105bool(false)106-- Changing mode of file to 37 --107bool(false)108-- Changing mode of file to 38 --109bool(false)110-- Changing mode of file to 39 --111bool(false)112-- Changing mode of file to 40 --113bool(false)114-- Changing mode of file to 41 --115bool(false)116-- Changing mode of file to 42 --117bool(false)118-- Changing mode of file to 43 --119bool(false)120-- Changing mode of file to 44 --121bool(false)122-- Changing mode of file to 45 --123bool(false)124-- Changing mode of file to 46 --125bool(false)126-- Changing mode of file to 47 --127bool(false)128-- Changing mode of file to 48 --129bool(false)130-- Changing mode of file to 49 --131bool(false)132-- Changing mode of file to 50 --133bool(false)134-- Changing mode of file to 51 --135bool(false)136-- Changing mode of file to 52 --137bool(false)138-- Changing mode of file to 53 --139bool(false)140-- Changing mode of file to 54 --141bool(false)142-- Changing mode of file to 55 --143bool(false)144-- Changing mode of file to 56 --145bool(false)146-- Changing mode of file to 57 --147bool(false)148-- Changing mode of file to 58 --149bool(false)150-- Changing mode of file to 59 --151bool(false)152-- Changing mode of file to 60 --153bool(false)154-- Changing mode of file to 61 --155bool(false)156-- Changing mode of file to 62 --157bool(false)158-- Changing mode of file to 63 --159bool(false)160-- Changing mode of file to 64 --161bool(false)162-- Changing mode of file to 65 --163bool(false)164-- Changing mode of file to 66 --165bool(false)166-- Changing mode of file to 67 --167bool(false)168-- Changing mode of file to 68 --169bool(false)170-- Changing mode of file to 69 --171bool(false)172-- Changing mode of file to 70 --173bool(false)174-- Changing mode of file to 71 --175bool(false)176-- Changing mode of file to 72 --177bool(false)178-- Changing mode of file to 73 --179bool(false)180-- Changing mode of file to 74 --181bool(false)182-- Changing mode of file to 75 --183bool(false)184-- Changing mode of file to 76 --185bool(false)186-- Changing mode of file to 77 --187bool(false)188-- Changing mode of file to 78 --189bool(false)190-- Changing mode of file to 79 --191bool(false)192-- Changing mode of file to 80 --193bool(false)194-- Changing mode of file to 81 --195bool(false)196-- Changing mode of file to 82 --197bool(false)198-- Changing mode of file to 83 --199bool(false)200-- Changing mode of file to 84 --201bool(false)202-- Changing mode of file to 85 --203bool(false)204-- Changing mode of file to 86 --205bool(false)206-- Changing mode of file to 87 --207bool(false)208-- Changing mode of file to 88 --209bool(false)210-- Changing mode of file to 89 --211bool(false)212-- Changing mode of file to 90 --213bool(false)214-- Changing mode of file to 91 --215bool(false)216-- Changing mode of file to 92 --217bool(false)218-- Changing mode of file to 93 --219bool(false)220-- Changing mode of file to 94 --221bool(false)222-- Changing mode of file to 95 --223bool(false)224-- Changing mode of file to 96 --225bool(false)226-- Changing mode of file to 97 --227bool(false)228-- Changing mode of file to 98 --229bool(false)230-- Changing mode of file to 99 --231bool(false)232-- Changing mode of file to 100 --233bool(false)234-- Changing mode of file to 101 --235bool(false)236-- Changing mode of file to 102 --237bool(false)238-- Changing mode of file to 103 --239bool(false)240-- Changing mode of file to 104 --241bool(false)242-- Changing mode of file to 105 --243bool(false)244-- Changing mode of file to 106 --245bool(false)246-- Changing mode of file to 107 --247bool(false)248-- Changing mode of file to 108 --249bool(false)250-- Changing mode of file to 109 --251bool(false)252-- Changing mode of file to 110 --253bool(false)254-- Changing mode of file to 111 --255bool(false)256-- Changing mode of file to 112 --257bool(false)258-- Changing mode of file to 113 --259bool(false)260-- Changing mode of file to 114 --261bool(false)262-- Changing mode of file to 115 --263bool(false)264-- Changing mode of file to 116 --265bool(false)266-- Changing mode of file to 117 --267bool(false)268-- Changing mode of file to 118 --269bool(false)270-- Changing mode of file to 119 --271bool(false)272-- Changing mode of file to 120 --273bool(false)274-- Changing mode of file to 121 --275bool(false)276-- Changing mode of file to 122 --277bool(false)278-- Changing mode of file to 123 --279bool(false)280-- Changing mode of file to 124 --281bool(false)282-- Changing mode of file to 125 --283bool(false)284-- Changing mode of file to 126 --285bool(false)286-- Changing mode of file to 127 --287bool(false)288-- Changing mode of file to 128 --289bool(false)290-- Changing mode of file to 129 --291bool(false)292-- Changing mode of file to 130 --293bool(false)294-- Changing mode of file to 131 --295bool(false)296-- Changing mode of file to 132 --297bool(false)298-- Changing mode of file to 133 --299bool(false)300-- Changing mode of file to 134 --301bool(false)302-- Changing mode of file to 135 --303bool(false)304-- Changing mode of file to 136 --305bool(false)306-- Changing mode of file to 137 --307bool(false)308-- Changing mode of file to 138 --309bool(false)310-- Changing mode of file to 139 --311bool(false)312-- Changing mode of file to 140 --313bool(false)314-- Changing mode of file to 141 --315bool(false)316-- Changing mode of file to 142 --317bool(false)318-- Changing mode of file to 143 --319bool(false)320-- Changing mode of file to 144 --321bool(false)322-- Changing mode of file to 145 --323bool(false)324-- Changing mode of file to 146 --325bool(false)326-- Changing mode of file to 147 --327bool(false)328-- Changing mode of file to 148 --329bool(false)330-- Changing mode of file to 149 --331bool(false)332-- Changing mode of file to 150 --333bool(false)334-- Changing mode of file to 151 --335bool(false)336-- Changing mode of file to 152 --337bool(false)338-- Changing mode of file to 153 --339bool(false)340-- Changing mode of file to 154 --341bool(false)342-- Changing mode of file to 155 --343bool(false)344-- Changing mode of file to 156 --345bool(false)346-- Changing mode of file to 157 --347bool(false)348-- Changing mode of file to 158 --349bool(false)350-- Changing mode of file to 159 --351bool(false)352-- Changing mode of file to 160 --353bool(false)354-- Changing mode of file to 161 --355bool(false)356-- Changing mode of file to 162 --357bool(false)358-- Changing mode of file to 163 --359bool(false)360-- Changing mode of file to 164 --361bool(false)362-- Changing mode of file to 165 --363bool(false)364-- Changing mode of file to 166 --365bool(false)366-- Changing mode of file to 167 --367bool(false)368-- Changing mode of file to 168 --369bool(false)370-- Changing mode of file to 169 --371bool(false)372-- Changing mode of file to 170 --373bool(false)374-- Changing mode of file to 171 --375bool(false)376-- Changing mode of file to 172 --377bool(false)378-- Changing mode of file to 173 --379bool(false)380-- Changing mode of file to 174 --381bool(false)382-- Changing mode of file to 175 --383bool(false)384-- Changing mode of file to 176 --385bool(false)386-- Changing mode of file to 177 --387bool(false)388-- Changing mode of file to 178 --389bool(false)390-- Changing mode of file to 179 --391bool(false)392-- Changing mode of file to 180 --393bool(false)394-- Changing mode of file to 181 --395bool(false)396-- Changing mode of file to 182 --397bool(false)398-- Changing mode of file to 183 --399bool(false)400-- Changing mode of file to 184 --401bool(false)402-- Changing mode of file to 185 --403bool(false)404-- Changing mode of file to 186 --405bool(false)406-- Changing mode of file to 187 --407bool(false)408-- Changing mode of file to 188 --409bool(false)410-- Changing mode of file to 189 --411bool(false)412-- Changing mode of file to 190 --413bool(false)414-- Changing mode of file to 191 --415bool(false)416-- Changing mode of file to 192 --417bool(false)418-- Changing mode of file to 193 --419bool(false)420-- Changing mode of file to 194 --421bool(false)422-- Changing mode of file to 195 --423bool(false)424-- Changing mode of file to 196 --425bool(false)426-- Changing mode of file to 197 --427bool(false)428-- Changing mode of file to 198 --429bool(false)430-- Changing mode of file to 199 --431bool(false)432-- Changing mode of file to 200 --433bool(false)434-- Changing mode of file to 201 --435bool(false)436-- Changing mode of file to 202 --437bool(false)438-- Changing mode of file to 203 --439bool(false)440-- Changing mode of file to 204 --441bool(false)442-- Changing mode of file to 205 --443bool(false)444-- Changing mode of file to 206 --445bool(false)446-- Changing mode of file to 207 --447bool(false)448-- Changing mode of file to 208 --449bool(false)450-- Changing mode of file to 209 --451bool(false)452-- Changing mode of file to 210 --453bool(false)454-- Changing mode of file to 211 --455bool(false)456-- Changing mode of file to 212 --457bool(false)458-- Changing mode of file to 213 --459bool(false)460-- Changing mode of file to 214 --461bool(false)462-- Changing mode of file to 215 --463bool(false)464-- Changing mode of file to 216 --465bool(false)466-- Changing mode of file to 217 --467bool(false)468-- Changing mode of file to 218 --469bool(false)470-- Changing mode of file to 219 --471bool(false)472-- Changing mode of file to 220 --473bool(false)474-- Changing mode of file to 221 --475bool(false)476-- Changing mode of file to 222 --477bool(false)478-- Changing mode of file to 223 --479bool(false)480-- Changing mode of file to 224 --481bool(false)482-- Changing mode of file to 225 --483bool(false)484-- Changing mode of file to 226 --485bool(false)486-- Changing mode of file to 227 --487bool(false)488-- Changing mode of file to 228 --489bool(false)490-- Changing mode of file to 229 --491bool(false)492-- Changing mode of file to 230 --493bool(false)494-- Changing mode of file to 231 --495bool(false)496-- Changing mode of file to 232 --497bool(false)498-- Changing mode of file to 233 --499bool(false)500-- Changing mode of file to 234 --501bool(false)502-- Changing mode of file to 235 --503bool(false)504-- Changing mode of file to 236 --505bool(false)506-- Changing mode of file to 237 --507bool(false)508-- Changing mode of file to 238 --509bool(false)510-- Changing mode of file to 239 --511bool(false)512-- Changing mode of file to 240 --513bool(false)514-- Changing mode of file to 241 --515bool(false)516-- Changing mode of file to 242 --517bool(false)518-- Changing mode of file to 243 --519bool(false)520-- Changing mode of file to 244 --521bool(false)522-- Changing mode of file to 245 --523bool(false)524-- Changing mode of file to 246 --525bool(false)526-- Changing mode of file to 247 --527bool(false)528-- Changing mode of file to 248 --529bool(false)530-- Changing mode of file to 249 --531bool(false)532-- Changing mode of file to 250 --533bool(false)534-- Changing mode of file to 251 --535bool(false)536-- Changing mode of file to 252 --537bool(false)538-- Changing mode of file to 253 --539bool(false)540-- Changing mode of file to 254 --541bool(false)542-- Changing mode of file to 255 --543bool(false)544-- Changing mode of file to 256 --545bool(false)546-- Changing mode of file to 257 --547bool(false)548-- Changing mode of file to 258 --549bool(false)550-- Changing mode of file to 259 --551bool(false)552-- Changing mode of file to 260 --553bool(false)554-- Changing mode of file to 261 --555bool(false)556-- Changing mode of file to 262 --557bool(false)558-- Changing mode of file to 263 --559bool(false)560-- Changing mode of file to 264 --561bool(false)562-- Changing mode of file to 265 --563bool(false)564-- Changing mode of file to 266 --565bool(false)566-- Changing mode of file to 267 --567bool(false)568-- Changing mode of file to 268 --569bool(false)570-- Changing mode of file to 269 --571bool(false)572-- Changing mode of file to 270 --573bool(false)574-- Changing mode of file to 271 --575bool(false)576-- Changing mode of file to 272 --577bool(false)578-- Changing mode of file to 273 --579bool(false)580-- Changing mode of file to 274 --581bool(false)582-- Changing mode of file to 275 --583bool(false)584-- Changing mode of file to 276 --585bool(false)586-- Changing mode of file to 277 --587bool(false)588-- Changing mode of file to 278 --589bool(false)590-- Changing mode of file to 279 --591bool(false)592-- Changing mode of file to 280 --593bool(false)594-- Changing mode of file to 281 --595bool(false)596-- Changing mode of file to 282 --597bool(false)598-- Changing mode of file to 283 --599bool(false)600-- Changing mode of file to 284 --601bool(false)602-- Changing mode of file to 285 --603bool(false)604-- Changing mode of file to 286 --605bool(false)606-- Changing mode of file to 287 --607bool(false)608-- Changing mode of file to 288 --609bool(false)610-- Changing mode of file to 289 --611bool(false)612-- Changing mode of file to 290 --613bool(false)614-- Changing mode of file to 291 --615bool(false)616-- Changing mode of file to 292 --617bool(false)618-- Changing mode of file to 293 --619bool(false)620-- Changing mode of file to 294 --621bool(false)622-- Changing mode of file to 295 --623bool(false)624-- Changing mode of file to 296 --625bool(false)626-- Changing mode of file to 297 --627bool(false)628-- Changing mode of file to 298 --629bool(false)630-- Changing mode of file to 299 --631bool(false)632-- Changing mode of file to 300 --633bool(false)634-- Changing mode of file to 301 --635bool(false)636-- Changing mode of file to 302 --637bool(false)638-- Changing mode of file to 303 --639bool(false)640-- Changing mode of file to 304 --641bool(false)642-- Changing mode of file to 305 --643bool(false)644-- Changing mode of file to 306 --645bool(false)646-- Changing mode of file to 307 --647bool(false)648-- Changing mode of file to 308 --649bool(false)650-- Changing mode of file to 309 --651bool(false)652-- Changing mode of file to 310 --653bool(false)654-- Changing mode of file to 311 --655bool(false)656-- Changing mode of file to 312 --657bool(false)658-- Changing mode of file to 313 --659bool(false)660-- Changing mode of file to 314 --661bool(false)662-- Changing mode of file to 315 --663bool(false)664-- Changing mode of file to 316 --665bool(false)666-- Changing mode of file to 317 --667bool(false)668-- Changing mode of file to 318 --669bool(false)670-- Changing mode of file to 319 --671bool(false)672-- Changing mode of file to 320 --673bool(false)674-- Changing mode of file to 321 --675bool(false)676-- Changing mode of file to 322 --677bool(false)678-- Changing mode of file to 323 --679bool(false)680-- Changing mode of file to 324 --681bool(false)682-- Changing mode of file to 325 --683bool(false)684-- Changing mode of file to 326 --685bool(false)686-- Changing mode of file to 327 --687bool(false)688-- Changing mode of file to 328 --689bool(false)690-- Changing mode of file to 329 --691bool(false)692-- Changing mode of file to 330 --693bool(false)694-- Changing mode of file to 331 --695bool(false)696-- Changing mode of file to 332 --697bool(false)698-- Changing mode of file to 333 --699bool(false)700-- Changing mode of file to 334 --701bool(false)702-- Changing mode of file to 335 --703bool(false)704-- Changing mode of file to 336 --705bool(false)706-- Changing mode of file to 337 --707bool(false)708-- Changing mode of file to 338 --709bool(false)710-- Changing mode of file to 339 --711bool(false)712-- Changing mode of file to 340 --713bool(false)714-- Changing mode of file to 341 --715bool(false)716-- Changing mode of file to 342 --717bool(false)718-- Changing mode of file to 343 --719bool(false)720-- Changing mode of file to 344 --721bool(false)722-- Changing mode of file to 345 --723bool(false)724-- Changing mode of file to 346 --725bool(false)726-- Changing mode of file to 347 --727bool(false)728-- Changing mode of file to 348 --729bool(false)730-- Changing mode of file to 349 --731bool(false)732-- Changing mode of file to 350 --733bool(false)734-- Changing mode of file to 351 --735bool(false)736-- Changing mode of file to 352 --737bool(false)738-- Changing mode of file to 353 --739bool(false)740-- Changing mode of file to 354 --741bool(false)742-- Changing mode of file to 355 --743bool(false)744-- Changing mode of file to 356 --745bool(false)746-- Changing mode of file to 357 --747bool(false)748-- Changing mode of file to 358 --749bool(false)750-- Changing mode of file to 359 --751bool(false)752-- Changing mode of file to 360 --753bool(false)754-- Changing mode of file to 361 --755bool(false)756-- Changing mode of file to 362 --757bool(false)758-- Changing mode of file to 363 --759bool(false)760-- Changing mode of file to 364 --761bool(false)762-- Changing mode of file to 365 --763bool(false)764-- Changing mode of file to 366 --765bool(false)766-- Changing mode of file to 367 --767bool(false)768-- Changing mode of file to 368 --769bool(false)770-- Changing mode of file to 369 --771bool(false)772-- Changing mode of file to 370 --773bool(false)774-- Changing mode of file to 371 --775bool(false)776-- Changing mode of file to 372 --777bool(false)778-- Changing mode of file to 373 --779bool(false)780-- Changing mode of file to 374 --781bool(false)782-- Changing mode of file to 375 --783bool(false)784-- Changing mode of file to 376 --785bool(false)786-- Changing mode of file to 377 --787bool(false)788-- Changing mode of file to 378 --789bool(false)790-- Changing mode of file to 379 --791bool(false)792-- Changing mode of file to 380 --793bool(false)794-- Changing mode of file to 381 --795bool(false)796-- Changing mode of file to 382 --797bool(false)798-- Changing mode of file to 383 --799bool(false)800-- Changing mode of file to 384 --801bool(false)802-- Changing mode of file to 385 --803bool(false)804-- Changing mode of file to 386 --805bool(false)806-- Changing mode of file to 387 --807bool(false)808-- Changing mode of file to 388 --809bool(false)810-- Changing mode of file to 389 --811bool(false)812-- Changing mode of file to 390 --813bool(false)814-- Changing mode of file to 391 --815bool(false)816-- Changing mode of file to 392 --817bool(false)818-- Changing mode of file to 393 --819bool(false)820-- Changing mode of file to 394 --821bool(false)822-- Changing mode of file to 395 --823bool(false)824-- Changing mode of file to 396 --825bool(false)826-- Changing mode of file to 397 --827bool(false)828-- Changing mode of file to 398 --829bool(false)830-- Changing mode of file to 399 --831bool(false)832-- Changing mode of file to 400 --833bool(false)834-- Changing mode of file to 401 --835bool(false)836-- Changing mode of file to 402 --837bool(false)838-- Changing mode of file to 403 --839bool(false)840-- Changing mode of file to 404 --841bool(false)842-- Changing mode of file to 405 --843bool(false)844-- Changing mode of file to 406 --845bool(false)846-- Changing mode of file to 407 --847bool(false)848-- Changing mode of file to 408 --849bool(false)850-- Changing mode of file to 409 --851bool(false)852-- Changing mode of file to 410 --853bool(false)854-- Changing mode of file to 411 --855bool(false)856-- Changing mode of file to 412 --857bool(false)858-- Changing mode of file to 413 --859bool(false)860-- Changing mode of file to 414 --861bool(false)862-- Changing mode of file to 415 --863bool(false)864-- Changing mode of file to 416 --865bool(false)866-- Changing mode of file to 417 --867bool(false)868-- Changing mode of file to 418 --869bool(false)870-- Changing mode of file to 419 --871bool(false)872-- Changing mode of file to 420 --873bool(false)874-- Changing mode of file to 421 --875bool(false)876-- Changing mode of file to 422 --877bool(false)878-- Changing mode of file to 423 --879bool(false)880-- Changing mode of file to 424 --881bool(false)882-- Changing mode of file to 425 --883bool(false)884-- Changing mode of file to 426 --885bool(false)886-- Changing mode of file to 427 --887bool(false)888-- Changing mode of file to 428 --889bool(false)890-- Changing mode of file to 429 --891bool(false)892-- Changing mode of file to 430 --893bool(false)894-- Changing mode of file to 431 --895bool(false)896-- Changing mode of file to 432 --897bool(false)898-- Changing mode of file to 433 --899bool(false)900-- Changing mode of file to 434 --901bool(false)902-- Changing mode of file to 435 --903bool(false)904-- Changing mode of file to 436 --905bool(false)906-- Changing mode of file to 437 --907bool(false)908-- Changing mode of file to 438 --909bool(false)910-- Changing mode of file to 439 --911bool(false)912-- Changing mode of file to 440 --913bool(false)914-- Changing mode of file to 441 --915bool(false)916-- Changing mode of file to 442 --917bool(false)918-- Changing mode of file to 443 --919bool(false)920-- Changing mode of file to 444 --921bool(false)922-- Changing mode of file to 445 --923bool(false)924-- Changing mode of file to 446 --925bool(false)926-- Changing mode of file to 447 --927bool(false)928-- Changing mode of file to 448 --929bool(false)930-- Changing mode of file to 449 --931bool(false)932-- Changing mode of file to 450 --933bool(false)934-- Changing mode of file to 451 --935bool(false)936-- Changing mode of file to 452 --937bool(false)938-- Changing mode of file to 453 --939bool(false)940-- Changing mode of file to 454 --941bool(false)942-- Changing mode of file to 455 --943bool(false)944-- Changing mode of file to 456 --945bool(false)946-- Changing mode of file to 457 --947bool(false)948-- Changing mode of file to 458 --949bool(false)950-- Changing mode of file to 459 --951bool(false)952-- Changing mode of file to 460 --953bool(false)954-- Changing mode of file to 461 --955bool(false)956-- Changing mode of file to 462 --957bool(false)958-- Changing mode of file to 463 --959bool(false)960-- Changing mode of file to 464 --961bool(false)962-- Changing mode of file to 465 --963bool(false)964-- Changing mode of file to 466 --965bool(false)966-- Changing mode of file to 467 --967bool(false)968-- Changing mode of file to 468 --969bool(false)970-- Changing mode of file to 469 --971bool(false)972-- Changing mode of file to 470 --973bool(false)974-- Changing mode of file to 471 --975bool(false)976-- Changing mode of file to 472 --977bool(false)978-- Changing mode of file to 473 --979bool(false)980-- Changing mode of file to 474 --981bool(false)982-- Changing mode of file to 475 --983bool(false)984-- Changing mode of file to 476 --985bool(false)986-- Changing mode of file to 477 --987bool(false)988-- Changing mode of file to 478 --989bool(false)990-- Changing mode of file to 479 --991bool(false)992-- Changing mode of file to 480 --993bool(false)994-- Changing mode of file to 481 --995bool(false)996-- Changing mode of file to 482 --997bool(false)998-- Changing mode of file to 483 --999bool(false)1000-- Changing mode of file to 484 --1001bool(false)1002-- Changing mode of file to 485 --1003bool(false)1004-- Changing mode of file to 486 --1005bool(false)1006-- Changing mode of file to 487 --1007bool(false)1008-- Changing mode of file to 488 --1009bool(false)1010-- Changing mode of file to 489 --1011bool(false)1012-- Changing mode of file to 490 --1013bool(false)1014-- Changing mode of file to 491 --1015bool(false)1016-- Changing mode of file to 492 --1017bool(false)1018-- Changing mode of file to 493 --1019bool(false)1020-- Changing mode of file to 494 --1021bool(false)1022-- Changing mode of file to 495 --1023bool(false)1024-- Changing mode of file to 496 --1025bool(false)1026-- Changing mode of file to 497 --1027bool(false)1028-- Changing mode of file to 498 --1029bool(false)1030-- Changing mode of file to 499 --1031bool(false)1032-- Changing mode of file to 500 --1033bool(false)1034-- Changing mode of file to 501 --1035bool(false)1036-- Changing mode of file to 502 --1037bool(false)1038-- Changing mode of file to 503 --1039bool(false)1040-- Changing mode of file to 504 --1041bool(false)1042-- Changing mode of file to 505 --1043bool(false)1044-- Changing mode of file to 506 --1045bool(false)1046-- Changing mode of file to 507 --1047bool(false)1048-- Changing mode of file to 508 --1049bool(false)1050-- Changing mode of file to 509 --1051bool(false)1052-- Changing mode of file to 510 --1053bool(false)1054-- Changing mode of file to 511 --1055bool(false)1056Done...
is_readable_basic.phpt
Source:is_readable_basic.phpt
...15// create a file16$filename = __DIR__."/is_readable.tmp";17create_file($filename);18$counter = 1;19/* loop to check if the file with new mode is readable20 using is_readable() */21for($mode = 0000; $mode <= 0777; $mode++) {22 echo "-- Changing mode of file to $mode --\n";23 chmod($filename, $mode); // change mode of file24 var_dump( is_readable($filename) );25 $counter++;26 clearstatcache();27}28// delete the temp file29delete_file($filename);30echo "Done\n";31?>32--EXPECT--33*** Testing is_readable(): basic functionality ***34-- Changing mode of file to 0 --35bool(false)36-- Changing mode of file to 1 --37bool(false)38-- Changing mode of file to 2 --39bool(false)40-- Changing mode of file to 3 --41bool(false)42-- Changing mode of file to 4 --43bool(false)44-- Changing mode of file to 5 --45bool(false)46-- Changing mode of file to 6 --47bool(false)48-- Changing mode of file to 7 --49bool(false)50-- Changing mode of file to 8 --51bool(false)52-- Changing mode of file to 9 --53bool(false)54-- Changing mode of file to 10 --55bool(false)56-- Changing mode of file to 11 --57bool(false)58-- Changing mode of file to 12 --59bool(false)60-- Changing mode of file to 13 --61bool(false)62-- Changing mode of file to 14 --63bool(false)64-- Changing mode of file to 15 --65bool(false)66-- Changing mode of file to 16 --67bool(false)68-- Changing mode of file to 17 --69bool(false)70-- Changing mode of file to 18 --71bool(false)72-- Changing mode of file to 19 --73bool(false)74-- Changing mode of file to 20 --75bool(false)76-- Changing mode of file to 21 --77bool(false)78-- Changing mode of file to 22 --79bool(false)80-- Changing mode of file to 23 --81bool(false)82-- Changing mode of file to 24 --83bool(false)84-- Changing mode of file to 25 --85bool(false)86-- Changing mode of file to 26 --87bool(false)88-- Changing mode of file to 27 --89bool(false)90-- Changing mode of file to 28 --91bool(false)92-- Changing mode of file to 29 --93bool(false)94-- Changing mode of file to 30 --95bool(false)96-- Changing mode of file to 31 --97bool(false)98-- Changing mode of file to 32 --99bool(false)100-- Changing mode of file to 33 --101bool(false)102-- Changing mode of file to 34 --103bool(false)104-- Changing mode of file to 35 --105bool(false)106-- Changing mode of file to 36 --107bool(false)108-- Changing mode of file to 37 --109bool(false)110-- Changing mode of file to 38 --111bool(false)112-- Changing mode of file to 39 --113bool(false)114-- Changing mode of file to 40 --115bool(false)116-- Changing mode of file to 41 --117bool(false)118-- Changing mode of file to 42 --119bool(false)120-- Changing mode of file to 43 --121bool(false)122-- Changing mode of file to 44 --123bool(false)124-- Changing mode of file to 45 --125bool(false)126-- Changing mode of file to 46 --127bool(false)128-- Changing mode of file to 47 --129bool(false)130-- Changing mode of file to 48 --131bool(false)132-- Changing mode of file to 49 --133bool(false)134-- Changing mode of file to 50 --135bool(false)136-- Changing mode of file to 51 --137bool(false)138-- Changing mode of file to 52 --139bool(false)140-- Changing mode of file to 53 --141bool(false)142-- Changing mode of file to 54 --143bool(false)144-- Changing mode of file to 55 --145bool(false)146-- Changing mode of file to 56 --147bool(false)148-- Changing mode of file to 57 --149bool(false)150-- Changing mode of file to 58 --151bool(false)152-- Changing mode of file to 59 --153bool(false)154-- Changing mode of file to 60 --155bool(false)156-- Changing mode of file to 61 --157bool(false)158-- Changing mode of file to 62 --159bool(false)160-- Changing mode of file to 63 --161bool(false)162-- Changing mode of file to 64 --163bool(false)164-- Changing mode of file to 65 --165bool(false)166-- Changing mode of file to 66 --167bool(false)168-- Changing mode of file to 67 --169bool(false)170-- Changing mode of file to 68 --171bool(false)172-- Changing mode of file to 69 --173bool(false)174-- Changing mode of file to 70 --175bool(false)176-- Changing mode of file to 71 --177bool(false)178-- Changing mode of file to 72 --179bool(false)180-- Changing mode of file to 73 --181bool(false)182-- Changing mode of file to 74 --183bool(false)184-- Changing mode of file to 75 --185bool(false)186-- Changing mode of file to 76 --187bool(false)188-- Changing mode of file to 77 --189bool(false)190-- Changing mode of file to 78 --191bool(false)192-- Changing mode of file to 79 --193bool(false)194-- Changing mode of file to 80 --195bool(false)196-- Changing mode of file to 81 --197bool(false)198-- Changing mode of file to 82 --199bool(false)200-- Changing mode of file to 83 --201bool(false)202-- Changing mode of file to 84 --203bool(false)204-- Changing mode of file to 85 --205bool(false)206-- Changing mode of file to 86 --207bool(false)208-- Changing mode of file to 87 --209bool(false)210-- Changing mode of file to 88 --211bool(false)212-- Changing mode of file to 89 --213bool(false)214-- Changing mode of file to 90 --215bool(false)216-- Changing mode of file to 91 --217bool(false)218-- Changing mode of file to 92 --219bool(false)220-- Changing mode of file to 93 --221bool(false)222-- Changing mode of file to 94 --223bool(false)224-- Changing mode of file to 95 --225bool(false)226-- Changing mode of file to 96 --227bool(false)228-- Changing mode of file to 97 --229bool(false)230-- Changing mode of file to 98 --231bool(false)232-- Changing mode of file to 99 --233bool(false)234-- Changing mode of file to 100 --235bool(false)236-- Changing mode of file to 101 --237bool(false)238-- Changing mode of file to 102 --239bool(false)240-- Changing mode of file to 103 --241bool(false)242-- Changing mode of file to 104 --243bool(false)244-- Changing mode of file to 105 --245bool(false)246-- Changing mode of file to 106 --247bool(false)248-- Changing mode of file to 107 --249bool(false)250-- Changing mode of file to 108 --251bool(false)252-- Changing mode of file to 109 --253bool(false)254-- Changing mode of file to 110 --255bool(false)256-- Changing mode of file to 111 --257bool(false)258-- Changing mode of file to 112 --259bool(false)260-- Changing mode of file to 113 --261bool(false)262-- Changing mode of file to 114 --263bool(false)264-- Changing mode of file to 115 --265bool(false)266-- Changing mode of file to 116 --267bool(false)268-- Changing mode of file to 117 --269bool(false)270-- Changing mode of file to 118 --271bool(false)272-- Changing mode of file to 119 --273bool(false)274-- Changing mode of file to 120 --275bool(false)276-- Changing mode of file to 121 --277bool(false)278-- Changing mode of file to 122 --279bool(false)280-- Changing mode of file to 123 --281bool(false)282-- Changing mode of file to 124 --283bool(false)284-- Changing mode of file to 125 --285bool(false)286-- Changing mode of file to 126 --287bool(false)288-- Changing mode of file to 127 --289bool(false)290-- Changing mode of file to 128 --291bool(false)292-- Changing mode of file to 129 --293bool(false)294-- Changing mode of file to 130 --295bool(false)296-- Changing mode of file to 131 --297bool(false)298-- Changing mode of file to 132 --299bool(false)300-- Changing mode of file to 133 --301bool(false)302-- Changing mode of file to 134 --303bool(false)304-- Changing mode of file to 135 --305bool(false)306-- Changing mode of file to 136 --307bool(false)308-- Changing mode of file to 137 --309bool(false)310-- Changing mode of file to 138 --311bool(false)312-- Changing mode of file to 139 --313bool(false)314-- Changing mode of file to 140 --315bool(false)316-- Changing mode of file to 141 --317bool(false)318-- Changing mode of file to 142 --319bool(false)320-- Changing mode of file to 143 --321bool(false)322-- Changing mode of file to 144 --323bool(false)324-- Changing mode of file to 145 --325bool(false)326-- Changing mode of file to 146 --327bool(false)328-- Changing mode of file to 147 --329bool(false)330-- Changing mode of file to 148 --331bool(false)332-- Changing mode of file to 149 --333bool(false)334-- Changing mode of file to 150 --335bool(false)336-- Changing mode of file to 151 --337bool(false)338-- Changing mode of file to 152 --339bool(false)340-- Changing mode of file to 153 --341bool(false)342-- Changing mode of file to 154 --343bool(false)344-- Changing mode of file to 155 --345bool(false)346-- Changing mode of file to 156 --347bool(false)348-- Changing mode of file to 157 --349bool(false)350-- Changing mode of file to 158 --351bool(false)352-- Changing mode of file to 159 --353bool(false)354-- Changing mode of file to 160 --355bool(false)356-- Changing mode of file to 161 --357bool(false)358-- Changing mode of file to 162 --359bool(false)360-- Changing mode of file to 163 --361bool(false)362-- Changing mode of file to 164 --363bool(false)364-- Changing mode of file to 165 --365bool(false)366-- Changing mode of file to 166 --367bool(false)368-- Changing mode of file to 167 --369bool(false)370-- Changing mode of file to 168 --371bool(false)372-- Changing mode of file to 169 --373bool(false)374-- Changing mode of file to 170 --375bool(false)376-- Changing mode of file to 171 --377bool(false)378-- Changing mode of file to 172 --379bool(false)380-- Changing mode of file to 173 --381bool(false)382-- Changing mode of file to 174 --383bool(false)384-- Changing mode of file to 175 --385bool(false)386-- Changing mode of file to 176 --387bool(false)388-- Changing mode of file to 177 --389bool(false)390-- Changing mode of file to 178 --391bool(false)392-- Changing mode of file to 179 --393bool(false)394-- Changing mode of file to 180 --395bool(false)396-- Changing mode of file to 181 --397bool(false)398-- Changing mode of file to 182 --399bool(false)400-- Changing mode of file to 183 --401bool(false)402-- Changing mode of file to 184 --403bool(false)404-- Changing mode of file to 185 --405bool(false)406-- Changing mode of file to 186 --407bool(false)408-- Changing mode of file to 187 --409bool(false)410-- Changing mode of file to 188 --411bool(false)412-- Changing mode of file to 189 --413bool(false)414-- Changing mode of file to 190 --415bool(false)416-- Changing mode of file to 191 --417bool(false)418-- Changing mode of file to 192 --419bool(false)420-- Changing mode of file to 193 --421bool(false)422-- Changing mode of file to 194 --423bool(false)424-- Changing mode of file to 195 --425bool(false)426-- Changing mode of file to 196 --427bool(false)428-- Changing mode of file to 197 --429bool(false)430-- Changing mode of file to 198 --431bool(false)432-- Changing mode of file to 199 --433bool(false)434-- Changing mode of file to 200 --435bool(false)436-- Changing mode of file to 201 --437bool(false)438-- Changing mode of file to 202 --439bool(false)440-- Changing mode of file to 203 --441bool(false)442-- Changing mode of file to 204 --443bool(false)444-- Changing mode of file to 205 --445bool(false)446-- Changing mode of file to 206 --447bool(false)448-- Changing mode of file to 207 --449bool(false)450-- Changing mode of file to 208 --451bool(false)452-- Changing mode of file to 209 --453bool(false)454-- Changing mode of file to 210 --455bool(false)456-- Changing mode of file to 211 --457bool(false)458-- Changing mode of file to 212 --459bool(false)460-- Changing mode of file to 213 --461bool(false)462-- Changing mode of file to 214 --463bool(false)464-- Changing mode of file to 215 --465bool(false)466-- Changing mode of file to 216 --467bool(false)468-- Changing mode of file to 217 --469bool(false)470-- Changing mode of file to 218 --471bool(false)472-- Changing mode of file to 219 --473bool(false)474-- Changing mode of file to 220 --475bool(false)476-- Changing mode of file to 221 --477bool(false)478-- Changing mode of file to 222 --479bool(false)480-- Changing mode of file to 223 --481bool(false)482-- Changing mode of file to 224 --483bool(false)484-- Changing mode of file to 225 --485bool(false)486-- Changing mode of file to 226 --487bool(false)488-- Changing mode of file to 227 --489bool(false)490-- Changing mode of file to 228 --491bool(false)492-- Changing mode of file to 229 --493bool(false)494-- Changing mode of file to 230 --495bool(false)496-- Changing mode of file to 231 --497bool(false)498-- Changing mode of file to 232 --499bool(false)500-- Changing mode of file to 233 --501bool(false)502-- Changing mode of file to 234 --503bool(false)504-- Changing mode of file to 235 --505bool(false)506-- Changing mode of file to 236 --507bool(false)508-- Changing mode of file to 237 --509bool(false)510-- Changing mode of file to 238 --511bool(false)512-- Changing mode of file to 239 --513bool(false)514-- Changing mode of file to 240 --515bool(false)516-- Changing mode of file to 241 --517bool(false)518-- Changing mode of file to 242 --519bool(false)520-- Changing mode of file to 243 --521bool(false)522-- Changing mode of file to 244 --523bool(false)524-- Changing mode of file to 245 --525bool(false)526-- Changing mode of file to 246 --527bool(false)528-- Changing mode of file to 247 --529bool(false)530-- Changing mode of file to 248 --531bool(false)532-- Changing mode of file to 249 --533bool(false)534-- Changing mode of file to 250 --535bool(false)536-- Changing mode of file to 251 --537bool(false)538-- Changing mode of file to 252 --539bool(false)540-- Changing mode of file to 253 --541bool(false)542-- Changing mode of file to 254 --543bool(false)544-- Changing mode of file to 255 --545bool(false)546-- Changing mode of file to 256 --547bool(true)548-- Changing mode of file to 257 --549bool(true)550-- Changing mode of file to 258 --551bool(true)552-- Changing mode of file to 259 --553bool(true)554-- Changing mode of file to 260 --555bool(true)556-- Changing mode of file to 261 --557bool(true)558-- Changing mode of file to 262 --559bool(true)560-- Changing mode of file to 263 --561bool(true)562-- Changing mode of file to 264 --563bool(true)564-- Changing mode of file to 265 --565bool(true)566-- Changing mode of file to 266 --567bool(true)568-- Changing mode of file to 267 --569bool(true)570-- Changing mode of file to 268 --571bool(true)572-- Changing mode of file to 269 --573bool(true)574-- Changing mode of file to 270 --575bool(true)576-- Changing mode of file to 271 --577bool(true)578-- Changing mode of file to 272 --579bool(true)580-- Changing mode of file to 273 --581bool(true)582-- Changing mode of file to 274 --583bool(true)584-- Changing mode of file to 275 --585bool(true)586-- Changing mode of file to 276 --587bool(true)588-- Changing mode of file to 277 --589bool(true)590-- Changing mode of file to 278 --591bool(true)592-- Changing mode of file to 279 --593bool(true)594-- Changing mode of file to 280 --595bool(true)596-- Changing mode of file to 281 --597bool(true)598-- Changing mode of file to 282 --599bool(true)600-- Changing mode of file to 283 --601bool(true)602-- Changing mode of file to 284 --603bool(true)604-- Changing mode of file to 285 --605bool(true)606-- Changing mode of file to 286 --607bool(true)608-- Changing mode of file to 287 --609bool(true)610-- Changing mode of file to 288 --611bool(true)612-- Changing mode of file to 289 --613bool(true)614-- Changing mode of file to 290 --615bool(true)616-- Changing mode of file to 291 --617bool(true)618-- Changing mode of file to 292 --619bool(true)620-- Changing mode of file to 293 --621bool(true)622-- Changing mode of file to 294 --623bool(true)624-- Changing mode of file to 295 --625bool(true)626-- Changing mode of file to 296 --627bool(true)628-- Changing mode of file to 297 --629bool(true)630-- Changing mode of file to 298 --631bool(true)632-- Changing mode of file to 299 --633bool(true)634-- Changing mode of file to 300 --635bool(true)636-- Changing mode of file to 301 --637bool(true)638-- Changing mode of file to 302 --639bool(true)640-- Changing mode of file to 303 --641bool(true)642-- Changing mode of file to 304 --643bool(true)644-- Changing mode of file to 305 --645bool(true)646-- Changing mode of file to 306 --647bool(true)648-- Changing mode of file to 307 --649bool(true)650-- Changing mode of file to 308 --651bool(true)652-- Changing mode of file to 309 --653bool(true)654-- Changing mode of file to 310 --655bool(true)656-- Changing mode of file to 311 --657bool(true)658-- Changing mode of file to 312 --659bool(true)660-- Changing mode of file to 313 --661bool(true)662-- Changing mode of file to 314 --663bool(true)664-- Changing mode of file to 315 --665bool(true)666-- Changing mode of file to 316 --667bool(true)668-- Changing mode of file to 317 --669bool(true)670-- Changing mode of file to 318 --671bool(true)672-- Changing mode of file to 319 --673bool(true)674-- Changing mode of file to 320 --675bool(true)676-- Changing mode of file to 321 --677bool(true)678-- Changing mode of file to 322 --679bool(true)680-- Changing mode of file to 323 --681bool(true)682-- Changing mode of file to 324 --683bool(true)684-- Changing mode of file to 325 --685bool(true)686-- Changing mode of file to 326 --687bool(true)688-- Changing mode of file to 327 --689bool(true)690-- Changing mode of file to 328 --691bool(true)692-- Changing mode of file to 329 --693bool(true)694-- Changing mode of file to 330 --695bool(true)696-- Changing mode of file to 331 --697bool(true)698-- Changing mode of file to 332 --699bool(true)700-- Changing mode of file to 333 --701bool(true)702-- Changing mode of file to 334 --703bool(true)704-- Changing mode of file to 335 --705bool(true)706-- Changing mode of file to 336 --707bool(true)708-- Changing mode of file to 337 --709bool(true)710-- Changing mode of file to 338 --711bool(true)712-- Changing mode of file to 339 --713bool(true)714-- Changing mode of file to 340 --715bool(true)716-- Changing mode of file to 341 --717bool(true)718-- Changing mode of file to 342 --719bool(true)720-- Changing mode of file to 343 --721bool(true)722-- Changing mode of file to 344 --723bool(true)724-- Changing mode of file to 345 --725bool(true)726-- Changing mode of file to 346 --727bool(true)728-- Changing mode of file to 347 --729bool(true)730-- Changing mode of file to 348 --731bool(true)732-- Changing mode of file to 349 --733bool(true)734-- Changing mode of file to 350 --735bool(true)736-- Changing mode of file to 351 --737bool(true)738-- Changing mode of file to 352 --739bool(true)740-- Changing mode of file to 353 --741bool(true)742-- Changing mode of file to 354 --743bool(true)744-- Changing mode of file to 355 --745bool(true)746-- Changing mode of file to 356 --747bool(true)748-- Changing mode of file to 357 --749bool(true)750-- Changing mode of file to 358 --751bool(true)752-- Changing mode of file to 359 --753bool(true)754-- Changing mode of file to 360 --755bool(true)756-- Changing mode of file to 361 --757bool(true)758-- Changing mode of file to 362 --759bool(true)760-- Changing mode of file to 363 --761bool(true)762-- Changing mode of file to 364 --763bool(true)764-- Changing mode of file to 365 --765bool(true)766-- Changing mode of file to 366 --767bool(true)768-- Changing mode of file to 367 --769bool(true)770-- Changing mode of file to 368 --771bool(true)772-- Changing mode of file to 369 --773bool(true)774-- Changing mode of file to 370 --775bool(true)776-- Changing mode of file to 371 --777bool(true)778-- Changing mode of file to 372 --779bool(true)780-- Changing mode of file to 373 --781bool(true)782-- Changing mode of file to 374 --783bool(true)784-- Changing mode of file to 375 --785bool(true)786-- Changing mode of file to 376 --787bool(true)788-- Changing mode of file to 377 --789bool(true)790-- Changing mode of file to 378 --791bool(true)792-- Changing mode of file to 379 --793bool(true)794-- Changing mode of file to 380 --795bool(true)796-- Changing mode of file to 381 --797bool(true)798-- Changing mode of file to 382 --799bool(true)800-- Changing mode of file to 383 --801bool(true)802-- Changing mode of file to 384 --803bool(true)804-- Changing mode of file to 385 --805bool(true)806-- Changing mode of file to 386 --807bool(true)808-- Changing mode of file to 387 --809bool(true)810-- Changing mode of file to 388 --811bool(true)812-- Changing mode of file to 389 --813bool(true)814-- Changing mode of file to 390 --815bool(true)816-- Changing mode of file to 391 --817bool(true)818-- Changing mode of file to 392 --819bool(true)820-- Changing mode of file to 393 --821bool(true)822-- Changing mode of file to 394 --823bool(true)824-- Changing mode of file to 395 --825bool(true)826-- Changing mode of file to 396 --827bool(true)828-- Changing mode of file to 397 --829bool(true)830-- Changing mode of file to 398 --831bool(true)832-- Changing mode of file to 399 --833bool(true)834-- Changing mode of file to 400 --835bool(true)836-- Changing mode of file to 401 --837bool(true)838-- Changing mode of file to 402 --839bool(true)840-- Changing mode of file to 403 --841bool(true)842-- Changing mode of file to 404 --843bool(true)844-- Changing mode of file to 405 --845bool(true)846-- Changing mode of file to 406 --847bool(true)848-- Changing mode of file to 407 --849bool(true)850-- Changing mode of file to 408 --851bool(true)852-- Changing mode of file to 409 --853bool(true)854-- Changing mode of file to 410 --855bool(true)856-- Changing mode of file to 411 --857bool(true)858-- Changing mode of file to 412 --859bool(true)860-- Changing mode of file to 413 --861bool(true)862-- Changing mode of file to 414 --863bool(true)864-- Changing mode of file to 415 --865bool(true)866-- Changing mode of file to 416 --867bool(true)868-- Changing mode of file to 417 --869bool(true)870-- Changing mode of file to 418 --871bool(true)872-- Changing mode of file to 419 --873bool(true)874-- Changing mode of file to 420 --875bool(true)876-- Changing mode of file to 421 --877bool(true)878-- Changing mode of file to 422 --879bool(true)880-- Changing mode of file to 423 --881bool(true)882-- Changing mode of file to 424 --883bool(true)884-- Changing mode of file to 425 --885bool(true)886-- Changing mode of file to 426 --887bool(true)888-- Changing mode of file to 427 --889bool(true)890-- Changing mode of file to 428 --891bool(true)892-- Changing mode of file to 429 --893bool(true)894-- Changing mode of file to 430 --895bool(true)896-- Changing mode of file to 431 --897bool(true)898-- Changing mode of file to 432 --899bool(true)900-- Changing mode of file to 433 --901bool(true)902-- Changing mode of file to 434 --903bool(true)904-- Changing mode of file to 435 --905bool(true)906-- Changing mode of file to 436 --907bool(true)908-- Changing mode of file to 437 --909bool(true)910-- Changing mode of file to 438 --911bool(true)912-- Changing mode of file to 439 --913bool(true)914-- Changing mode of file to 440 --915bool(true)916-- Changing mode of file to 441 --917bool(true)918-- Changing mode of file to 442 --919bool(true)920-- Changing mode of file to 443 --921bool(true)922-- Changing mode of file to 444 --923bool(true)924-- Changing mode of file to 445 --925bool(true)926-- Changing mode of file to 446 --927bool(true)928-- Changing mode of file to 447 --929bool(true)930-- Changing mode of file to 448 --931bool(true)932-- Changing mode of file to 449 --933bool(true)934-- Changing mode of file to 450 --935bool(true)936-- Changing mode of file to 451 --937bool(true)938-- Changing mode of file to 452 --939bool(true)940-- Changing mode of file to 453 --941bool(true)942-- Changing mode of file to 454 --943bool(true)944-- Changing mode of file to 455 --945bool(true)946-- Changing mode of file to 456 --947bool(true)948-- Changing mode of file to 457 --949bool(true)950-- Changing mode of file to 458 --951bool(true)952-- Changing mode of file to 459 --953bool(true)954-- Changing mode of file to 460 --955bool(true)956-- Changing mode of file to 461 --957bool(true)958-- Changing mode of file to 462 --959bool(true)960-- Changing mode of file to 463 --961bool(true)962-- Changing mode of file to 464 --963bool(true)964-- Changing mode of file to 465 --965bool(true)966-- Changing mode of file to 466 --967bool(true)968-- Changing mode of file to 467 --969bool(true)970-- Changing mode of file to 468 --971bool(true)972-- Changing mode of file to 469 --973bool(true)974-- Changing mode of file to 470 --975bool(true)976-- Changing mode of file to 471 --977bool(true)978-- Changing mode of file to 472 --979bool(true)980-- Changing mode of file to 473 --981bool(true)982-- Changing mode of file to 474 --983bool(true)984-- Changing mode of file to 475 --985bool(true)986-- Changing mode of file to 476 --987bool(true)988-- Changing mode of file to 477 --989bool(true)990-- Changing mode of file to 478 --991bool(true)992-- Changing mode of file to 479 --993bool(true)994-- Changing mode of file to 480 --995bool(true)996-- Changing mode of file to 481 --997bool(true)998-- Changing mode of file to 482 --999bool(true)1000-- Changing mode of file to 483 --1001bool(true)1002-- Changing mode of file to 484 --1003bool(true)1004-- Changing mode of file to 485 --1005bool(true)1006-- Changing mode of file to 486 --1007bool(true)1008-- Changing mode of file to 487 --1009bool(true)1010-- Changing mode of file to 488 --1011bool(true)1012-- Changing mode of file to 489 --1013bool(true)1014-- Changing mode of file to 490 --1015bool(true)1016-- Changing mode of file to 491 --1017bool(true)1018-- Changing mode of file to 492 --1019bool(true)1020-- Changing mode of file to 493 --1021bool(true)1022-- Changing mode of file to 494 --1023bool(true)1024-- Changing mode of file to 495 --1025bool(true)1026-- Changing mode of file to 496 --1027bool(true)1028-- Changing mode of file to 497 --1029bool(true)1030-- Changing mode of file to 498 --1031bool(true)1032-- Changing mode of file to 499 --1033bool(true)1034-- Changing mode of file to 500 --1035bool(true)1036-- Changing mode of file to 501 --1037bool(true)1038-- Changing mode of file to 502 --1039bool(true)1040-- Changing mode of file to 503 --1041bool(true)1042-- Changing mode of file to 504 --1043bool(true)1044-- Changing mode of file to 505 --1045bool(true)1046-- Changing mode of file to 506 --1047bool(true)1048-- Changing mode of file to 507 --1049bool(true)1050-- Changing mode of file to 508 --1051bool(true)1052-- Changing mode of file to 509 --1053bool(true)1054-- Changing mode of file to 510 --1055bool(true)1056-- Changing mode of file to 511 --1057bool(true)1058Done...
main.swift
Source:main.swift
...46//print(unionG)47//unionG.union(lnv: 0, rnv: 3)48//print(unionG)49//let graph = Graph<String, Int>.init()50//graph.addEdge(from: "V1", to: "V0", weight: 9)51//graph.addEdge(from: "V1", to: "V2", weight: 3)52//graph.addEdge(from: "V2", to: "V3", weight: 5)53//graph.addEdge(from: "V3", to: "V4", weight: 1)54//graph.addEdge(from: "V2", to: "V0", weight: 2)55//graph.addEdge(from: "V0", to: "V4", weight: 6)56//graph.addVertex(vertex: "V5")57//graph.removeVertex(vertex: "V0")58//graph.graphPrint()59//graph.addEdge(from: "a", to: "V1", weight: 9)60//graph.addEdge(from: "V0", to: "V4", weight: 9)61//graph.addEdge(from: "V2", to: "V0", weight: 3)62//graph.addEdge(from: "V1", to: "V2", weight: 5)63//graph.addEdge(from: "V3", to: "V1", weight: 1)64//graph.addEdge(from: "V2", to: "V5", weight: 2)65//graph.addEdge(from: "V2", to: "V4", weight: 6)66//graph.addEdge(from: "V4", to: "V6", weight: 9)67//graph.addEdge(from: "V4", to: "V7", weight: 3)68//graph.addEdge(from: "V5", to: "V3", weight: 5)69//graph.addEdge(from: "V5", to: "V7", weight: 1)70//graph.addEdge(from: "V6", to: "V2", weight: 2)71//graph.addEdge(from: "V6", to: "V1", weight: 6)72//graph.bfs(vertex: "V0") {73// print($0)74// return false75//}76//let graph1 = Graph<Int, Int>.init()77//graph1.addEdge(from: 0, to: 1, weight: nil)78//graph1.addEdge(from: 1, to: 0, weight: nil)79//80//graph1.addEdge(from: 1, to: 2, weight: nil)81//graph1.addEdge(from: 2, to: 1, weight: nil)82//83//graph1.addEdge(from: 1, to: 3, weight: nil)84//graph1.addEdge(from: 3, to: 1, weight: nil)85//86//graph1.addEdge(from: 1, to: 5, weight: nil)87//graph1.addEdge(from: 5, to: 1, weight: nil)88//89//graph1.addEdge(from: 1, to: 6, weight: nil)90//graph1.addEdge(from: 6, to: 1, weight: nil)91//92//graph1.addEdge(from: 2, to: 4, weight: nil)93//graph1.addEdge(from: 4, to: 2, weight: nil)94//95//graph1.addEdge(from: 3, to: 7, weight: nil)96//graph1.addEdge(from: 7, to: 3, weight: nil)97//98//graph1.dfs(vertex: 1) {99// print($0)100// return false101//}102//let graph2 = Graph<String, Int>.init()103//graph2.addEdge(from: "a", to: "e")104//graph2.addEdge(from: "a", to: "b")105//graph2.addEdge(from: "b", to: "e")106//graph2.addEdge(from: "c", to: "b")107//graph2.addEdge(from: "d", to: "a")108//graph2.addEdge(from: "e", to: "c")109//graph2.addEdge(from: "e", to: "f")110//graph2.addEdge(from: "f", to: "c")111//graph2.dfs(vertex: "a") {112// print($0)113// return false114//}115//let graph = Graph<String, Int>.init()116//graph.addEdge(from: "A", to: "B")117//graph.addEdge(from: "A", to: "D")118//graph.addEdge(from: "B", to: "F")119//graph.addEdge(from: "C", to: "B")120//graph.addEdge(from: "C", to: "F")121//graph.addEdge(from: "E", to: "A")122//graph.addEdge(from: "E", to: "B")123//graph.addEdge(from: "E", to: "F")124//print(graph.topologicalSort())125//let heap = BinaryHeap<Int>.init()126//heap.add(element: 68)127//heap.add(element: 72)128//heap.add(element: 43)129//heap.add(element: 50)130//heap.add(element: 38)131//heap.heapPrint()132//heap.add(element: 100)133//heap.heapPrint()134//let top = heap.replae(element: 1)135//heap.heapPrint()136//print(top)137//let graph = Graph<Int, Int>.init()138//graph.addEdge(from: 0, to: 2, weight: 2)139//graph.addEdge(from: 0, to: 4, weight: 7)140//graph.addEdge(from: 2, to: 0, weight: 2)141//graph.addEdge(from: 2, to: 1, weight: 3)142//graph.addEdge(from: 2, to: 6, weight: 6)143//graph.addEdge(from: 2, to: 5, weight: 3)144//graph.addEdge(from: 2, to: 4, weight: 4)145//graph.addEdge(from: 2, to: 4, weight: 4)146//graph.addEdge(from: 1, to: 2, weight: 3)147//graph.addEdge(from: 1, to: 6, weight: 7)148//graph.addEdge(from: 1, to: 5, weight: 1)149//graph.addEdge(from: 4, to: 0, weight: 7)150//graph.addEdge(from: 4, to: 2, weight: 4)151//graph.addEdge(from: 4, to: 6, weight: 8)152//graph.addEdge(from: 6, to: 5, weight: 4)153//graph.addEdge(from: 6, to: 2, weight: 6)154//graph.addEdge(from: 6, to: 4, weight: 8)155//graph.addEdge(from: 6, to: 1, weight: 7)156//graph.addEdge(from: 5, to: 6, weight: 4)157//graph.addEdge(from: 5, to: 1, weight: 1)158//graph.addEdge(from: 5, to: 2, weight: 3)159//graph.addEdge(from: 5, to: 7, weight: 5)160//graph.addEdge(from: 7, to: 5, weight: 5)161//graph.addEdge(from: 7, to: 3, weight: 9)162//graph.addEdge(from: 3, to: 7, weight: 9)163//print(graph.prim())164//print(graph.kruskal())165//let graph = Graph<String, Int>.init()166//graph.addEdge(from: "A", to: "B", weight: 17)167//graph.addEdge(from: "B", to: "A", weight: 17)168//graph.addEdge(from: "A", to: "F", weight: 1)169//graph.addEdge(from: "F", to: "A", weight: 1)170//graph.addEdge(from: "A", to: "E", weight: 16)171//graph.addEdge(from: "E", to: "A", weight: 16)172//graph.addEdge(from: "B", to: "F", weight: 11)173//graph.addEdge(from: "F", to: "B", weight: 11)174//graph.addEdge(from: "B", to: "D", weight: 5)175//graph.addEdge(from: "D", to: "B", weight: 16)176//graph.addEdge(from: "B", to: "C", weight: 6)177//graph.addEdge(from: "C", to: "B", weight: 6)178//graph.addEdge(from: "F", to: "E", weight: 33)179//graph.addEdge(from: "E", to: "F", weight: 33)180//graph.addEdge(from: "F", to: "D", weight: 14)181//graph.addEdge(from: "D", to: "F", weight: 14)182//graph.addEdge(from: "E", to: "D", weight: 4)183//graph.addEdge(from: "D", to: "E", weight: 4)184//graph.addEdge(from: "D", to: "C", weight: 10)185//graph.addEdge(from: "C", to: "D", weight: 10)186//print(graph.prim())187//print(graph.kruskal())188//let graph = Graph<String, Int>.init()189//graph.addEdge(from: "A", to: "B", weight: 10)190//graph.addEdge(from: "A", to: "E", weight: 100)191//graph.addEdge(from: "A", to: "D", weight: 30)192//graph.addEdge(from: "B", to: "C", weight: 50)193//graph.addEdge(from: "C", to: "E", weight: 10)194//graph.addEdge(from: "D", to: "C", weight: 20)195//graph.addEdge(from: "D", to: "E", weight: 60)196//graph.addEdge(from: "B", to: "A", weight: 10)197//graph.addEdge(from: "E", to: "A", weight: 100)198//graph.addEdge(from: "D", to: "A", weight: 30)199//graph.addEdge(from: "C", to: "B", weight: 50)200//graph.addEdge(from: "E", to: "C", weight: 10)201//graph.addEdge(from: "C", to: "D", weight: 20)202//graph.addEdge(from: "E", to: "D", weight: 60)203//print(graph.dijkstra(vertex: "A", addWeightClosure: {$0 + $1}) ?? 0)204//print(graph.bellmanFord(beginVertex: "A", beginWeight: 0, addWeightClosure: {$0 + $1}) ?? 0)205//print(graph.floyd(addWeightClosure: {$0 + $1}))206//let tree = BinarySearchTree<Int>.init()207//let array = [1, 4, 88, 85, 100, 61, 63, 21, 5, 9, 92, 59, 95, 47, 44, 26, 58, 13]208//for number in array {209// tree.add(element: number)210//}211//tree.traversalClosure = { (element,stop) -> () in212// if element == 61 {213// stop = true214// }215// print(element)216//}217//print(tree.isCompleteTree())218//tree.remove(element: 67)219//print(tree.inorderTraversal())220//print(tree.preorderTraversal())221//tree.remove(element: 57)222//print(tree.inorderTraversal())223//print(tree.postorderTraversal())224//let avlTree = AVLTree<Int>.init()225//let array = [41, 97, 18, 61, 100, 80, 69, 76, 3, 78, 8, 33, 79, 75, 40]226//for number in array {227// avlTree.add(element: number)228//}229//avlTree.traversalClosure = {print($0)}230//avlTree.add(element: 90)231//print(avlTree.preorderTraversal())232//print(avlTree.inorderTraversal())233//let rbTree = RBTree<Int>.init()234//let array = [33, 11, 55, 14, 24, 47, 78, 44, 27, 70, 86, 37, 97, 61, 74, 67, 99, 21, 28]235//for number in array {236// rbTree.add(element: number)237//}238//rbTree.traversalClosure = { (element,stop) -> () in239// print(element)240//}241//rbTree.remove(element: 97)242//rbTree.remove(element: 21)243//rbTree.remove(element: 28)244//rbTree.remove(element: 11)245//246//print(rbTree.preorderTraversal())...
ViewController.swift
Source:ViewController.swift
1///// Copyright (c) 2018 Razeware LLC2///3/// Permission is hereby granted, free of charge, to any person obtaining a copy4/// of this software and associated documentation files (the "Software"), to deal5/// in the Software without restriction, including without limitation the rights6/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell7/// copies of the Software, and to permit persons to whom the Software is8/// furnished to do so, subject to the following conditions:9///10/// The above copyright notice and this permission notice shall be included in11/// all copies or substantial portions of the Software.12///13/// Notwithstanding the foregoing, you may not use, copy, modify, merge, publish,14/// distribute, sublicense, create a derivative work, and/or sell copies of the15/// Software in any work that is designed, intended, or marketed for pedagogical or16/// instructional purposes related to programming, coding, application development,17/// or information technology. Permission for such use, copying, modification,18/// merger, publication, distribution, sublicensing, creation of derivative works,19/// or sale is expressly withheld.20///21/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR22/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,23/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE24/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER25/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,26/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN27/// THE SOFTWARE.28import UIKit29class ViewController: UIViewController {30 // MARK: - IBOutlets31 @IBOutlet var toDoListCollectionView: UICollectionView!32 @IBOutlet var warriorPath: UIView!33 @IBOutlet var warriorCatImageView: UIImageView!34 // MARK: - Properties35 var toDos: [ToDo] = []36 var completedToDos: [ToDo] = []37 // MARK: - View Life Cycle38 override func viewDidLoad() {39 super.viewDidLoad()40 toDoListCollectionView.register(UINib(nibName: "ToDoCell", bundle: nil),41 forCellWithReuseIdentifier: "cell")42 setWarriorPosition()43 }44}45// MARK: - IBActions46extension ViewController {47 @IBAction func addToDo(_ sender: UIBarButtonItem) {48 let alertController = UIAlertController(title: "Create Task",49 message: "What kind of task would you like to create?",50 preferredStyle: .alert)51 52 alertController.addAction(UIAlertAction(title: "Task with Checklist", style: .default) { [weak self] action in53 self?.createTaskWithChecklist()54 })55 56 alertController.addAction(UIAlertAction(title: "Task without Checklist", style: .default) { [weak self] action in57 self?.createDefaultTask()58 })59 60 present(alertController, animated: true)61 }62}63// MARK: - Internal64extension ViewController {65 func setWarriorPosition() {66 var percentageComplete = 0.067 let completed = Double(completedToDos.count)68 let all = Double(toDos.count)69 70 if !completedToDos.isEmpty {71 percentageComplete = completed / all72 }73 74 let x = warriorPath.frame.width * CGFloat(percentageComplete)75 76 warriorCatImageView.frame = CGRect(x: x,77 y: warriorPath.frame.midY - 50,78 width: 100,79 height: 100)80 }81 func createTaskWithChecklist() {82 let alertController = UIAlertController(title: "Task Name",83 message: "",84 preferredStyle: .alert)85 86 alertController.addTextField { textField in87 textField.placeholder = "Enter Task Title"88 }89 90 for _ in 1...4 {91 alertController.addTextField { textField in92 textField.placeholder = "Add Subtask"93 }94 }95 96 let saveAction = UIAlertAction(title: "Save", style: .default) { [weak self] alert in97 let titleTextField = alertController.textFields![0]98 let firstTextField = alertController.textFields![1]99 let secondTextField = alertController.textFields![2]100 let thirdTextField = alertController.textFields![3]101 let fourthTextField = alertController.textFields![4]102 103 let textFields = [firstTextField,104 secondTextField,105 thirdTextField,106 fourthTextField]107 var subtasks: [ToDo] = []108 109 for textField in textFields {110 if textField.text != "" {111 let currentSubtask = ToDoItem(name: textField.text!)112 subtasks.append(currentSubtask)113 }114 }115 116 let currentToDo = ToDoItemWithChecklist(name: titleTextField.text!, subtasks: subtasks)117 self?.toDos.append(currentToDo)118 self?.toDoListCollectionView.reloadData()119 self?.setWarriorPosition()120 }121 122 let cancelAction = UIAlertAction(title: "Cancel", style: .default)123 alertController.addAction(saveAction)124 alertController.addAction(cancelAction)125 126 present(alertController, animated: true)127 }128 129 func createDefaultTask() {130 let alertController = UIAlertController(title: "Task Name",131 message: "",132 preferredStyle: .alert)133 134 alertController.addTextField { textField in135 textField.placeholder = "Enter Task Title"136 }137 138 let saveAction = UIAlertAction(title: "Save", style: .default) { [weak self] alert in139 let titleTextField = alertController.textFields![0]140 141 if titleTextField.text != "" {142 let currentToDo = ToDoItem(name: titleTextField.text!)143 self?.toDos.append(currentToDo)144 self?.toDoListCollectionView.reloadData()145 self?.setWarriorPosition()146 }147 }148 149 let cancelAction = UIAlertAction(title: "Cancel", style: .default)150 alertController.addAction(saveAction)151 alertController.addAction(cancelAction)152 153 present(alertController, animated: true)154 }155}156// MARK: - UICollectionViewDataSource157extension ViewController: UICollectionViewDataSource {158 159 func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {160 return toDos.count161 }162 163 func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {164 165 let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! ToDoCell166 167 let currentToDo = toDos[indexPath.row]168 169 cell.toDoLabel.text = currentToDo.name170 171 if currentToDo.isComplete {172 cell.checkBoxView.backgroundColor = UIColor(red:0.24, green:0.56, blue:0.30, alpha:1.0)173 } else {174 cell.checkBoxView.backgroundColor = UIColor.white175 }176 177 if currentToDo is ToDoItemWithChecklist {178 cell.subtasks = currentToDo.subtasks179 }180 181 cell.layoutSubviews()182 return cell183 }184}185// MARK: - UICollectionViewDelegate186extension ViewController: UICollectionViewDelegate {187 func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {188 var currentToDo = toDos[indexPath.row]189 if currentToDo.isComplete {190 currentToDo.isComplete = false191 completedToDos = completedToDos.filter { $0.name != currentToDo.name }192 } else {193 currentToDo.isComplete = true194 completedToDos.append(currentToDo)195 }196 setWarriorPosition()197 collectionView.reloadData()198 }199}200// MARK: - UICollectionViewDelegateFlowLayout201extension ViewController: UICollectionViewDelegateFlowLayout {202 203 func collectionView(_ collectionView: UICollectionView,204 layout collectionViewLayout: UICollectionViewLayout,205 sizeForItemAt indexPath: IndexPath) -> CGSize {206 let width = collectionView.frame.width207 208 let currentToDo = toDos[indexPath.row]209 210 let heightVariance = 60 * (currentToDo.subtasks.count)211 let addedHeight = CGFloat(heightVariance)212 213 let height = collectionView.frame.height * 0.15 + addedHeight214 215 return CGSize(width: width, height: height)216 }217 218 func collectionView(_ collectionView: UICollectionView,219 layout collectionViewLayout: UICollectionViewLayout,220 minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {221 return 0.0222 }...
bug20927.phpt
Source:bug20927.phpt
2Bug #20927 (Segfault on wordwrap statement)3--FILE--4<?php5$string = str_repeat("1234567890 X ", 10);6$break = str_repeat("a-very-long-break-string-to-clobber-the-heap", 8);7$linelength = 10;8echo "Length of original string: ".strlen($string)."\n";9echo "Length of break string: ".strlen($break)."\n";10var_dump(wordwrap($string, $linelength, $break, 1));11?>12--EXPECT--13Length of original string: 13014Length of break string: 35215string(6799) "1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapXa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heap1234567890a-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapa-very-long-break-string-to-clobber-the-heapX "...
ToStringWithPrecision.swift
Source:ToStringWithPrecision.swift
1import Foundation2import Numerics3public protocol ToStringWithPrecision {4 5 func toString(precision : Int?) -> String6}7extension Float : ToStringWithPrecision {8 9 public func toString(precision : Int? = nil) -> String {10 if let precision = precision {11 return String(format: "%.\(precision)f", self)12 } else {13 return self.description14 }15 }16 17}18extension Double : ToStringWithPrecision {19 20 public func toString(precision : Int? = nil) -> String {21 if let precision = precision {22 return String(format: "%.\(precision)f", self)23 } else {24 return self.description25 }26 }27 28}29extension Complex : ToStringWithPrecision {30 31 public func toString(precision : Int? = nil) -> String {32 return Complex.dispatch(33 float: {34 if imaginary.isZero {35 let x = (real as! Float).toString(precision: precision)36 return x37 } else if real.isZero {38 let y = (imaginary as! Float).toString(precision: precision)39 return "\(y)i"40 } else if imaginary > 0 {41 let x = (real as! Float).toString(precision: precision)42 let y = (imaginary as! Float).toString(precision: precision)43 return "\(x) + \(y)i"44 } else {45 let x = (real as! Float).toString(precision: precision)46 let y = (-imaginary as! Float).toString(precision: precision)47 return "\(x) - \(y)i"48 }49 },50 double: {51 if imaginary.isZero {52 let x = (real as! Double).toString(precision: precision)53 return x54 } else if real.isZero {55 let y = (imaginary as! Double).toString(precision: precision)56 return "\(y)i"57 } else if imaginary > 0 {58 let x = (real as! Double).toString(precision: precision)59 let y = (imaginary as! Double).toString(precision: precision)60 return "\(x) + \(y)i"61 } else {62 let x = (real as! Double).toString(precision: precision)63 let y = (-imaginary as! Double).toString(precision: precision)64 return "\(x) - \(y)i"65 }66 }67 )68 }69 70}71extension Matrix : ToStringWithPrecision, CustomStringConvertible where Element : ToStringWithPrecision {72 73 private func left(row : Int) -> String {74 guard rows > 1 else { return "(" }75 if row == 0 { return "â" }76 if row == rows - 1 { return "â" }77 return "â"78 }79 80 private func right(row : Int) -> String {81 guard rows > 1 else { return ")" }82 if row == 0 { return "â" }83 if row == rows - 1 { return "â " }84 return "â"85 }86 87 private func extend(_ s : String, width : Int) -> String {88 var t = s89 while t.count < width {90 t.append(" ")91 }92 return t93 }94 public func toString(precision : Int? = nil) -> String {95 var column_widths = [Int](repeating: 0, count: columns)96 for c in 0 ..< columns {97 var W = 098 for r in 0 ..< rows {99 let width = self[r, c].toString(precision: precision).count100 W = max(width, W)101 }102 column_widths[c] = W103 }104 var s : String = ""105 for r in 0 ..< rows {106 if r > 0 { s.append("\n") }107 s.append(left(row: r))108 for c in 0 ..< columns {109 if c > 0 { s.append(" ") }110 s.append(extend(self[r, c].toString(precision: precision), width: column_widths[c]))111 }112 s.append(right(row: r))113 }114 return s115 }116 117 public var description: String {118 if _rows == 0 || _columns == 0 {119 return "\(_rows)x\(_columns)-matrix"120 } else {121 return "\(_rows)x\(_columns)-matrix:\n\(toString(precision: nil))"122 }123 }124}125extension Vector : ToStringWithPrecision where Element : ToStringWithPrecision {126 127 public func toString(precision : Int? = nil) -> String {128 var s : String = "["129 var first = true130 for elem in self {131 if first {132 first = false133 } else {134 s.append(", ")135 }136 s.append(elem.toString(precision: precision))137 }138 s.append("]")139 return s140 }141 142}...
to
Using AI Code Generation
1import UIKit2class QuickSort {3 func quickSort(array: [Int]) -> [Int] {4 if array.count <= 1 {5 }6 let less = array.filter { $0 < pivot }7 let equal = array.filter { $0 == pivot }8 let greater = array.filter { $0 > pivot }9 return quickSort(array: less) + equal + quickSort(array: greater)10 }11}12let quickSort = QuickSort()13print(quickSort.quickSort(array: array))14import UIKit15class InsertionSort {16 func insertionSort(array: [Int]) -> [Int] {17 for x in 1..<a.count {18 while y > 0 && a[y] < a[y - 1] {19 a.swapAt(y - 1, y)20 }21 }22 }23}24let insertionSort = InsertionSort()25print(insertionSort.insertionSort(array: array))26import UIKit27class BubbleSort {28 func bubbleSort(array: [Int]) -> [Int] {29 for _ in 0..<a.count {30 for j in 1..<a.count {31 if a[j] < a[j - 1] {32 a.swapAt(j - 1, j)33 }34 }35 }36 }37}38let bubbleSort = BubbleSort()39print(bubbleSort.bubbleSort(array: array))40import UIKit41class SelectionSort {42 func selectionSort(array: [Int]) -> [Int] {
to
Using AI Code Generation
1import Foundation2class QuickSort{3 func quickSort(array: [Int], left: Int, right: Int) -> [Int] {4 if left < right {5 let pivotIndex = partition(&array, left: left, right: right)6 quickSort(array: &array, left: left, right: pivotIndex - 1)7 quickSort(array: &array, left: pivotIndex + 1, right: right)8 }9 }10 func partition(_ array: inout [Int], left: Int, right: Int) -> Int {11 for i in left..<right {12 if array[i] <= pivot {13 array.swapAt(i, partitionIndex)14 }15 }16 array.swapAt(partitionIndex, right)17 }18}19import Foundation20class QuickSort{21 func quickSort(array: [Int], left: Int, right: Int) -> [Int] {22 if left < right {23 let pivotIndex = partition(&array, left: left, right: right)24 quickSort(array: &array, left: left, right: pivotIndex - 1)25 quickSort(array: &array, left: pivotIndex + 1, right: right)26 }27 }28 func partition(_ array: inout [Int], left: Int, right: Int) -> Int {29 for i in left..<right {30 if array[i] <= pivot {31 array.swapAt(i, partitionIndex)32 }33 }34 array.swapAt(partitionIndex, right)35 }36}37import Foundation38class QuickSort{39 func quickSort(array: [Int], left: Int, right: Int) -> [Int] {40 if left < right {41 let pivotIndex = partition(&array, left: left, right: right)42 quickSort(array: &array, left: left, right
to
Using AI Code Generation
1import Foundation2let quickSort = QuickSort()3let mergeSort = MergeSort()4let countingSort = CountingSort()5let heapSort = HeapSort()6let insertionSort = InsertionSort()7let selectionSort = SelectionSort()8let bubbleSort = BubbleSort()9print("Quick Sort: \(quickSort.sort(array: array))")10print("Merge Sort: \(mergeSort.sort(array: array2))")11print("Counting Sort: \(countingSort.sort(array: array3))")12print("Heap Sort: \(heapSort.sort(array: array4))")13print("Insertion Sort: \(insertionSort.sort(array: array5))")14print("Selection Sort: \(selectionSort.sort(array: array6))")15print("Bubble Sort: \(bubbleSort.sort(array: array7))")
to
Using AI Code Generation
1import Foundation2let a = QuickSort()3a.quickSort([1,2,3,4,5,6,7,8,9,10])4a.quickSort([10,9,8,7,6,5,4,3,2,1])5a.quickSort([5,4,3,2,1,6,7,8,9,10])6a.quickSort([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])7a.quickSort([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])8a.quickSort([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])9a.quickSort([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])10a.quickSort([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])11a.quickSort([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])12a.quickSort([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])13a.quickSort([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])14a.quickSort([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24])15a.quickSort([1,2,3,4,5,
to
Using AI Code Generation
1import Foundation2class QuickSort {3 func sort(array: [Int]) -> [Int] {4 if array.count <= 1 {5 }6 else {7 let smallerThanPivot = array.filter { $0 < pivot }8 let equalToPivot = array.filter { $0 == pivot }9 let greaterThanPivot = array.filter { $0 > pivot }10 return sort(array: smallerThanPivot) + equalToPivot + sort(array: greaterThanPivot)11 }12 }13}14let quickSort = QuickSort()15print(quickSort.sort(array: array))16import Foundation17class HeapSort {18 func sort(array: [Int]) -> [Int] {
to
Using AI Code Generation
1import Foundation2class QuickSort {3 init(array: [Int]) {4 }5 func quickSort() {6 quickSort(low: 0, high: size - 1)7 }8 func quickSort(low: Int, high: Int) {9 if low < high {10 let pi = partition(low: low, high: high)11 quickSort(low: low, high: pi - 1)12 quickSort(low: pi + 1, high: high)13 }14 }15 func partition(low: Int, high: Int) -> Int {16 for j in low..<high {17 if array[j] <= pivot {18 array.swapAt(i, j)19 }20 }21 array.swapAt(i + 1, high)22 }23 func printArray() {24 print(array)25 }26}27let quickSort = QuickSort(array: array)28quickSort.quickSort()29quickSort.printArray()
to
Using AI Code Generation
1import Foundation2func main() {3 print("Before Sort: \(arr)")4 QuickSort(&arr, 0, arr.count - 1)5 print("After Sort: \(arr)")6}7func QuickSort(_ arr: inout [Int], _ low: Int, _ high: Int) {8 if low < high {9 let pi = partition(&arr, low, high)10 QuickSort(&arr, low, pi - 1)11 QuickSort(&arr, pi + 1, high)12 }13}14func partition(_ arr: inout [Int], _ low: Int, _ high: Int) -> Int {15 for j in low...high {16 if arr[j] < pivot {17 arr.swapAt(i, j)18 }19 }20 arr.swapAt(i + 1, high)21}22main()
to
Using AI Code Generation
1import UIKit2class ViewController: UIViewController {3 var sortedArr = [Int]()4 override func viewDidLoad() {5 super.viewDidLoad()6 sortedArr = quickSort(arr)7 print(sortedArr)8 }9 override func didReceiveMemoryWarning() {10 super.didReceiveMemoryWarning()11 }12 func quickSort(_ arr: [Int]) -> [Int] {13 if arr.count <= 1 {14 }15 arr.remove(at: arr.count/2)16 var less = [Int]()17 var greater = [Int]()18 for val in arr {19 if val <= pivot {20 less.append(val)21 } else {22 greater.append(val)23 }24 }25 return quickSort(less) + [pivot] + quickSort(greater)26 }27}28import UIKit29class ViewController: UIViewController {30 var sortedArr = [Int]()31 override func viewDidLoad() {32 super.viewDidLoad()33 sortedArr = quickSort(arr, 0, arr.count-1)34 print(sortedArr)35 }36 override func didReceiveMemoryWarning() {37 super.didReceiveMemoryWarning()38 }39 func quickSort(_ arr: [Int], _ left: Int, _ right: Int) -> [Int] {40 if left >= right {41 }42 let pivot = arr[(left+right)/2]43 var index = partition(&arr, left, right, pivot)44 quickSort(arr, left, index-1)45 quickSort(arr, index, right)46 }47 func partition(_ arr: inout [Int], _ left: Int, _ right: Int, _ pivot: Int) -> Int {
to
Using AI Code Generation
1import Foundation2func quickSort(_ A: inout [Int], _ low: Int, _ high: Int) {3 if low < high {4 let p = partition(&A, low, high)5 quickSort(&A, low, p - 1)6 quickSort(&A, p + 1, high)7 }8}9func partition(_ A: inout [Int], _ low: Int, _ high: Int) -> Int {10 for j in low..<high {11 if A[j] < pivot {12 A.swapAt(i, j)13 }14 }15 A.swapAt(i, high)16}17func printArray(_ A: [Int]) {18 for i in 0..<A.count {19 print(A[i], terminator: " ")20 }21 print()22}23quickSort(&array, 0, array.count - 1)24print("Sorted array: ", terminator: "")25printArray(array)
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!