summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/implode1.phpt
blob: 64c31048c8d7fbd285e5d182a526361cd2cfea53 (plain)
ofshex dumpascii
0000 2d 2d 54 45 53 54 2d 2d 0a 54 65 73 74 20 69 6d 70 6c 6f 64 65 28 29 20 66 75 6e 63 74 69 6f 6e --TEST--.Test.implode().function
0020 0a 2d 2d 46 49 4c 45 2d 2d 0a 3c 3f 70 68 70 0a 2f 2a 20 50 72 6f 74 6f 74 79 70 65 3a 20 73 74 .--FILE--.<?php./*.Prototype:.st
0040 72 69 6e 67 20 69 6d 70 6c 6f 64 65 20 28 20 73 74 72 69 6e 67 20 24 67 6c 75 65 2c 20 61 72 72 ring.implode.(.string.$glue,.arr
0060 61 79 20 24 70 69 65 63 65 73 20 29 3b 0a 20 20 20 44 65 73 63 72 69 70 74 69 6f 6e 3a 20 52 65 ay.$pieces.);....Description:.Re
0080 74 75 72 6e 73 20 61 20 73 74 72 69 6e 67 20 63 6f 6e 74 61 69 6e 69 6e 67 20 61 20 73 74 72 69 turns.a.string.containing.a.stri
00a0 6e 67 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 61 6c 6c 20 74 68 65 0a 20 20 20 ng.representation.of.all.the....
00c0 20 20 20 20 20 20 20 20 20 20 20 20 20 61 72 72 61 79 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 74 .............array.elements.in.t
00e0 68 65 20 73 61 6d 65 20 6f 72 64 65 72 2c 20 77 69 74 68 20 74 68 65 20 67 6c 75 65 20 73 74 72 he.same.order,.with.the.glue.str
0100 69 6e 67 20 62 65 74 77 65 65 6e 20 65 61 63 68 20 65 6c 65 6d 65 6e 74 2e 0a 2a 2f 0a 65 63 68 ing.between.each.element..*/.ech
0120 6f 20 22 2a 2a 2a 20 54 65 73 74 69 6e 67 20 69 6d 70 6c 6f 64 65 28 29 20 66 6f 72 20 62 61 73 o."***.Testing.implode().for.bas
0140 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 20 2a 2a 2a 5c 6e 22 3b 0a 24 61 72 72 61 79 73 20 3d 20 ic.operations.***\n";.$arrays.=.
0160 61 72 72 61 79 20 28 0a 20 20 61 72 72 61 79 28 31 2c 32 29 2c 0a 20 20 61 72 72 61 79 28 31 2e array.(...array(1,2),...array(1.
0180 31 2c 32 2e 32 29 2c 0a 20 20 61 72 72 61 79 28 61 72 72 61 79 28 32 29 2c 61 72 72 61 79 28 31 1,2.2),...array(array(2),array(1
01a0 29 29 2c 0a 20 20 61 72 72 61 79 28 66 61 6c 73 65 2c 74 72 75 65 29 2c 0a 20 20 61 72 72 61 79 )),...array(false,true),...array
01c0 28 29 2c 0a 20 20 61 72 72 61 79 28 22 61 22 2c 22 61 61 61 61 22 2c 22 62 22 2c 22 62 62 62 62 (),...array("a","aaaa","b","bbbb
01e0 22 2c 22 63 22 2c 22 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 22 29 0a 29 ","c","ccccccccccccccccccccc").)
0200 3b 0a 2f 2a 20 6c 6f 6f 70 20 74 6f 20 6f 75 74 70 75 74 20 73 74 72 69 6e 67 20 77 69 74 68 20 ;./*.loop.to.output.string.with.
0220 27 2c 20 27 20 61 73 20 24 67 6c 75 65 2c 20 75 73 69 6e 67 20 69 6d 70 6c 6f 64 65 28 29 20 2a ',.'.as.$glue,.using.implode().*
0240 2f 0a 66 6f 72 65 61 63 68 20 28 24 61 72 72 61 79 73 20 61 73 20 24 61 72 72 61 79 29 20 7b 0a /.foreach.($arrays.as.$array).{.
0260 20 20 76 61 72 5f 64 75 6d 70 28 20 69 6d 70 6c 6f 64 65 28 27 2c 20 27 2c 20 24 61 72 72 61 79 ..var_dump(.implode(',.',.$array
0280 29 20 29 3b 0a 20 20 76 61 72 5f 64 75 6d 70 28 24 61 72 72 61 79 29 3b 0a 7d 0a 0a 65 63 68 6f ).);...var_dump($array);.}..echo
02a0 20 22 5c 6e 2a 2a 2a 20 54 65 73 74 69 6e 67 20 69 6d 70 6c 6f 64 65 28 29 20 77 69 74 68 20 76 ."\n***.Testing.implode().with.v
02c0 61 72 69 61 74 69 6f 6e 73 20 6f 66 20 67 6c 75 65 20 2a 2a 2a 5c 6e 22 3b 0a 2f 2a 20 63 68 65 ariations.of.glue.***\n";./*.che
02e0 63 6b 69 6e 67 20 70 6f 73 73 69 62 6c 65 20 76 61 72 69 61 74 69 6f 6e 73 20 2a 2f 0a 24 70 69 cking.possible.variations.*/.$pi
0300 65 63 65 73 20 3d 20 61 72 72 61 79 20 28 0a 20 20 32 2c 0a 20 20 30 2c 0a 20 20 2d 36 33 39 2c eces.=.array.(...2,...0,...-639,
0320 0a 20 20 74 72 75 65 2c 0a 20 20 22 50 48 50 22 2c 0a 20 20 66 61 6c 73 65 2c 0a 20 20 4e 55 4c ...true,..."PHP",...false,...NUL
0340 4c 2c 0a 20 20 22 22 2c 0a 20 20 22 20 22 2c 0a 20 20 22 73 74 72 69 6e 67 5c 78 30 30 77 69 74 L,..."",...".",..."string\x00wit
0360 68 5c 78 30 30 2e 2e 2e 5c 30 22 0a 29 3b 0a 24 67 6c 75 65 73 20 3d 20 61 72 72 61 79 20 28 0a h\x00...\0".);.$glues.=.array.(.
0380 20 20 22 54 52 55 45 22 2c 0a 20 20 74 72 75 65 2c 0a 20 20 66 61 6c 73 65 2c 0a 20 20 61 72 72 .."TRUE",...true,...false,...arr
03a0 61 79 28 22 6b 65 79 31 22 2c 20 22 6b 65 79 32 22 29 2c 0a 20 20 22 22 2c 0a 20 20 22 20 22 2c ay("key1",."key2"),..."",...".",
03c0 0a 20 20 22 73 74 72 69 6e 67 5c 78 30 30 62 65 74 77 65 65 6e 22 2c 0a 20 20 4e 55 4c 4c 2c 0a ..."string\x00between",...NULL,.
03e0 20 20 2d 30 2c 0a 20 20 27 5c 30 27 0a 29 3b 0a 2f 2a 20 6c 6f 6f 70 20 74 68 72 6f 75 67 68 20 ..-0,...'\0'.);./*.loop.through.
0400 74 6f 20 64 69 73 70 6c 61 79 20 61 20 73 74 72 69 6e 67 20 63 6f 6e 74 61 69 6e 69 6e 67 20 61 to.display.a.string.containing.a
0420 6c 6c 20 74 68 65 20 61 72 72 61 79 20 24 70 69 65 63 65 73 20 69 6e 20 74 68 65 20 73 61 6d 65 ll.the.array.$pieces.in.the.same
0440 20 6f 72 64 65 72 2c 0a 20 20 20 77 69 74 68 20 74 68 65 20 24 67 6c 75 65 20 73 74 72 69 6e 67 .order,....with.the.$glue.string
0460 20 62 65 74 77 65 65 6e 20 65 61 63 68 20 65 6c 65 6d 65 6e 74 20 20 2a 2f 0a 24 63 6f 75 6e 74 .between.each.element..*/.$count
0480 65 72 20 3d 20 31 3b 0a 66 6f 72 65 61 63 68 28 24 67 6c 75 65 73 20 61 73 20 24 67 6c 75 65 29 er.=.1;.foreach($glues.as.$glue)
04a0 20 7b 0a 20 20 65 63 68 6f 20 22 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 24 63 6f 75 6e 74 65 72 .{...echo."--.Iteration.$counter
04c0 20 2d 2d 5c 6e 22 3b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 20 20 20 76 61 72 5f 64 75 6d 70 28 .--\n";...try.{........var_dump(
04e0 69 6d 70 6c 6f 64 65 28 24 67 6c 75 65 2c 20 24 70 69 65 63 65 73 29 29 3b 0a 20 20 7d 20 63 61 implode($glue,.$pieces));...}.ca
0500 74 63 68 20 28 54 79 70 65 45 72 72 6f 72 20 24 65 78 63 65 70 74 69 6f 6e 29 20 7b 0a 20 20 20 tch.(TypeError.$exception).{....
0520 20 20 20 65 63 68 6f 20 24 65 78 63 65 70 74 69 6f 6e 2d 3e 67 65 74 4d 65 73 73 61 67 65 28 29 ...echo.$exception->getMessage()
0540 20 2e 20 22 5c 6e 22 3b 0a 20 20 7d 0a 20 20 24 63 6f 75 6e 74 65 72 2b 2b 3b 0a 7d 0a 0a 2f 2a ..."\n";...}...$counter++;.}../*
0560 20 65 6d 70 74 79 20 73 74 72 69 6e 67 20 2a 2f 0a 65 63 68 6f 20 22 5c 6e 2a 2a 2a 20 54 65 73 .empty.string.*/.echo."\n***.Tes
0580 74 69 6e 67 20 69 6d 70 6c 6f 64 65 28 29 20 6f 6e 20 65 6d 70 74 79 20 73 74 72 69 6e 67 20 2a ting.implode().on.empty.string.*
05a0 2a 2a 5c 6e 22 3b 0a 74 72 79 20 7b 0a 20 20 20 20 69 6d 70 6c 6f 64 65 28 22 22 29 3b 0a 7d 20 **\n";.try.{.....implode("");.}.
05c0 63 61 74 63 68 20 28 54 79 70 65 45 72 72 6f 72 20 24 65 29 20 7b 0a 20 20 20 20 65 63 68 6f 20 catch.(TypeError.$e).{.....echo.
05e0 24 65 2d 3e 67 65 74 4d 65 73 73 61 67 65 28 29 2c 20 22 5c 6e 22 3b 0a 7d 0a 0a 2f 2a 20 63 68 $e->getMessage(),."\n";.}../*.ch
0600 65 63 6b 69 6e 67 20 73 75 62 2d 61 72 72 61 79 73 20 2a 2f 0a 65 63 68 6f 20 22 5c 6e 2a 2a 2a ecking.sub-arrays.*/.echo."\n***
0620 20 54 65 73 74 69 6e 67 20 69 6d 70 6c 6f 64 65 28 29 20 6f 6e 20 73 75 62 2d 61 72 72 61 79 73 .Testing.implode().on.sub-arrays
0640 20 2a 2a 2a 5c 6e 22 3b 0a 24 73 75 62 5f 61 72 72 61 79 20 3d 20 61 72 72 61 79 28 61 72 72 61 .***\n";.$sub_array.=.array(arra
0660 79 28 31 2c 32 2c 33 2c 34 29 2c 20 61 72 72 61 79 28 31 20 3d 3e 20 22 6f 6e 65 22 2c 20 32 20 y(1,2,3,4),.array(1.=>."one",.2.
0680 3d 3e 20 22 74 77 6f 22 29 2c 20 22 50 48 50 22 2c 20 35 30 29 3b 0a 76 61 72 5f 64 75 6d 70 28 =>."two"),."PHP",.50);.var_dump(
06a0 69 6d 70 6c 6f 64 65 28 22 54 45 53 54 22 2c 20 24 73 75 62 5f 61 72 72 61 79 29 29 3b 0a 74 72 implode("TEST",.$sub_array));.tr
06c0 79 20 7b 0a 20 20 20 76 61 72 5f 64 75 6d 70 28 69 6d 70 6c 6f 64 65 28 61 72 72 61 79 28 31 2c y.{....var_dump(implode(array(1,
06e0 20 32 2c 20 33 2c 20 34 29 2c 20 24 73 75 62 5f 61 72 72 61 79 29 29 3b 0a 7d 20 63 61 74 63 68 .2,.3,.4),.$sub_array));.}.catch
0700 20 28 54 79 70 65 45 72 72 6f 72 20 24 65 78 63 65 70 74 69 6f 6e 29 20 7b 0a 20 20 65 63 68 6f .(TypeError.$exception).{...echo
0720 20 24 65 78 63 65 70 74 69 6f 6e 2d 3e 67 65 74 4d 65 73 73 61 67 65 28 29 20 2e 20 22 5c 6e 22 .$exception->getMessage()..."\n"
0740 3b 0a 7d 0a 74 72 79 20 7b 0a 20 20 20 76 61 72 5f 64 75 6d 70 28 20 69 6d 70 6c 6f 64 65 28 32 ;.}.try.{....var_dump(.implode(2
0760 2c 20 24 73 75 62 5f 61 72 72 61 79 29 20 29 3b 0a 7d 20 63 61 74 63 68 20 28 54 79 70 65 45 72 ,.$sub_array).);.}.catch.(TypeEr
0780 72 6f 72 20 24 65 78 63 65 70 74 69 6f 6e 29 20 7b 0a 20 20 65 63 68 6f 20 24 65 78 63 65 70 74 ror.$exception).{...echo.$except
07a0 69 6f 6e 2d 3e 67 65 74 4d 65 73 73 61 67 65 28 29 20 2e 20 22 5c 6e 22 3b 0a 7d 0a 0a 65 63 68 ion->getMessage()..."\n";.}..ech
07c0 6f 20 22 5c 6e 2a 2a 2a 20 54 65 73 74 69 6e 67 20 69 6d 70 6c 6f 64 65 28 29 20 6f 6e 20 6f 62 o."\n***.Testing.implode().on.ob
07e0 6a 65 63 74 73 20 2a 2a 2a 5c 6e 22 3b 0a 2f 2a 20 63 68 65 63 6b 69 6e 67 20 6f 6e 20 6f 62 6a jects.***\n";./*.checking.on.obj
0800 65 63 74 73 20 2a 2f 0a 63 6c 61 73 73 20 66 6f 6f 0a 7b 0a 20 20 66 75 6e 63 74 69 6f 6e 20 5f ects.*/.class.foo.{...function._
0820 5f 74 6f 53 74 72 69 6e 67 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 22 4f 62 6a 65 63 74 _toString().{.....return."Object
0840 22 3b 0a 20 20 7d 0a 7d 0a 0a 24 6f 62 6a 20 3d 20 6e 65 77 20 66 6f 6f 28 29 3b 20 2f 2f 63 72 ";...}.}..$obj.=.new.foo();.//cr
0860 65 61 74 69 6e 67 20 6e 65 77 20 6f 62 6a 65 63 74 0a 24 61 72 72 20 3d 20 61 72 72 61 79 28 29 eating.new.object.$arr.=.array()
0880 3b 0a 24 61 72 72 5b 30 5d 20 3d 20 26 24 6f 62 6a 3b 0a 24 61 72 72 5b 31 5d 20 3d 20 26 24 6f ;.$arr[0].=.&$obj;.$arr[1].=.&$o
08a0 62 6a 3b 0a 76 61 72 5f 64 75 6d 70 28 20 69 6d 70 6c 6f 64 65 28 22 2c 22 2c 20 24 61 72 72 29 bj;.var_dump(.implode(",",.$arr)
08c0 20 29 3b 0a 76 61 72 5f 64 75 6d 70 28 24 61 72 72 29 3b 0a 0a 2f 2a 20 43 68 65 63 6b 69 6e 67 .);.var_dump($arr);../*.Checking
08e0 20 6f 6e 20 72 65 73 6f 75 72 63 65 20 74 79 70 65 73 20 2a 2f 0a 65 63 68 6f 20 22 5c 6e 2a 2a .on.resource.types.*/.echo."\n**
0900 2a 20 54 65 73 74 69 6e 67 20 65 6e 64 28 29 20 6f 6e 20 72 65 73 6f 75 72 63 65 20 74 79 70 65 *.Testing.end().on.resource.type
0920 20 2a 2a 2a 5c 6e 22 3b 0a 2f 2a 20 66 69 6c 65 20 74 79 70 65 20 72 65 73 6f 75 72 63 65 20 2a .***\n";./*.file.type.resource.*
0940 2f 0a 24 66 69 6c 65 5f 68 61 6e 64 6c 65 20 3d 20 66 6f 70 65 6e 28 5f 5f 46 49 4c 45 5f 5f 2c /.$file_handle.=.fopen(__FILE__,
0960 20 22 72 22 29 3b 0a 0a 2f 2a 20 64 69 72 65 63 74 6f 72 79 20 74 79 70 65 20 72 65 73 6f 75 72 ."r");../*.directory.type.resour
0980 63 65 20 2a 2f 0a 24 64 69 72 5f 68 61 6e 64 6c 65 20 3d 20 6f 70 65 6e 64 69 72 28 20 5f 5f 44 ce.*/.$dir_handle.=.opendir(.__D
09a0 49 52 5f 5f 20 29 3b 0a 0a 2f 2a 20 73 74 6f 72 65 20 72 65 73 6f 75 72 63 65 73 20 69 6e 20 61 IR__.);../*.store.resources.in.a
09c0 72 72 61 79 20 66 6f 72 20 63 6f 6d 70 61 72 69 73 6f 6e 20 2a 2f 0a 24 72 65 73 6f 75 72 63 65 rray.for.comparison.*/.$resource
09e0 73 20 3d 20 61 72 72 61 79 28 24 66 69 6c 65 5f 68 61 6e 64 6c 65 2c 20 24 64 69 72 5f 68 61 6e s.=.array($file_handle,.$dir_han
0a00 64 6c 65 29 3b 0a 0a 76 61 72 5f 64 75 6d 70 28 20 69 6d 70 6c 6f 64 65 28 22 3a 3a 22 2c 20 24 dle);..var_dump(.implode("::",.$
0a20 72 65 73 6f 75 72 63 65 73 29 20 29 3b 0a 0a 65 63 68 6f 20 22 5c 6e 2a 2a 2a 20 54 65 73 74 69 resources).);..echo."\n***.Testi
0a40 6e 67 20 65 72 72 6f 72 20 63 6f 6e 64 69 74 69 6f 6e 73 20 2a 2a 2a 5c 6e 22 3b 0a 0a 2f 2a 20 ng.error.conditions.***\n";../*.
0a60 6f 6e 6c 79 20 67 6c 75 65 20 2a 2f 0a 74 72 79 20 7b 0a 20 20 20 20 76 61 72 5f 64 75 6d 70 28 only.glue.*/.try.{.....var_dump(
0a80 20 69 6d 70 6c 6f 64 65 28 22 67 6c 75 65 22 29 20 29 3b 0a 7d 20 63 61 74 63 68 20 28 54 79 70 .implode("glue").);.}.catch.(Typ
0aa0 65 45 72 72 6f 72 20 24 65 29 20 7b 0a 20 20 20 20 65 63 68 6f 20 24 65 2d 3e 67 65 74 4d 65 73 eError.$e).{.....echo.$e->getMes
0ac0 73 61 67 65 28 29 2c 20 22 5c 6e 22 3b 0a 7d 0a 0a 2f 2a 20 69 6e 74 20 61 73 20 70 69 65 63 65 sage(),."\n";.}../*.int.as.piece
0ae0 73 20 2a 2f 0a 74 72 79 20 7b 0a 20 20 20 20 76 61 72 5f 64 75 6d 70 28 20 69 6d 70 6c 6f 64 65 s.*/.try.{.....var_dump(.implode
0b00 28 22 67 6c 75 65 22 2c 31 32 33 34 29 20 29 3b 0a 7d 20 63 61 74 63 68 20 28 54 79 70 65 45 72 ("glue",1234).);.}.catch.(TypeEr
0b20 72 6f 72 20 24 65 29 20 7b 0a 20 20 20 20 65 63 68 6f 20 24 65 2d 3e 67 65 74 4d 65 73 73 61 67 ror.$e).{.....echo.$e->getMessag
0b40 65 28 29 2c 20 22 5c 6e 22 3b 0a 7d 0a 0a 2f 2a 20 4e 55 4c 4c 20 61 73 20 70 69 65 63 65 73 20 e(),."\n";.}../*.NULL.as.pieces.
0b60 2a 2f 0a 74 72 79 20 7b 0a 20 20 20 20 76 61 72 5f 64 75 6d 70 28 20 69 6d 70 6c 6f 64 65 28 22 */.try.{.....var_dump(.implode("
0b80 67 6c 75 65 22 2c 20 4e 55 4c 4c 29 20 29 3b 0a 7d 20 63 61 74 63 68 20 28 54 79 70 65 45 72 72 glue",.NULL).);.}.catch.(TypeErr
0ba0 6f 72 20 24 65 29 20 7b 0a 20 20 20 20 65 63 68 6f 20 24 65 2d 3e 67 65 74 4d 65 73 73 61 67 65 or.$e).{.....echo.$e->getMessage
0bc0 28 29 2c 20 22 5c 6e 22 3b 0a 7d 0a 0a 2f 2a 20 70 69 65 63 65 73 20 61 73 20 4e 55 4c 4c 20 61 (),."\n";.}../*.pieces.as.NULL.a
0be0 72 72 61 79 20 2a 2f 0a 74 72 79 20 7b 0a 20 20 20 20 76 61 72 5f 64 75 6d 70 28 20 69 6d 70 6c rray.*/.try.{.....var_dump(.impl
0c00 6f 64 65 28 22 2c 22 2c 20 61 72 72 61 79 28 4e 55 4c 4c 29 29 20 29 3b 0a 7d 20 63 61 74 63 68 ode(",",.array(NULL)).);.}.catch
0c20 20 28 54 79 70 65 45 72 72 6f 72 20 24 65 29 20 7b 0a 20 20 20 20 65 63 68 6f 20 24 65 2d 3e 67 .(TypeError.$e).{.....echo.$e->g
0c40 65 74 4d 65 73 73 61 67 65 28 29 2c 20 22 5c 6e 22 3b 0a 7d 0a 0a 2f 2a 20 69 6e 74 65 67 65 72 etMessage(),."\n";.}../*.integer
0c60 20 61 73 20 67 6c 75 65 20 2a 2f 0a 74 72 79 20 7b 0a 20 20 20 20 76 61 72 5f 64 75 6d 70 28 20 .as.glue.*/.try.{.....var_dump(.
0c80 69 6d 70 6c 6f 64 65 28 31 32 2c 20 22 70 69 65 63 65 73 22 29 20 29 3b 0a 7d 20 63 61 74 63 68 implode(12,."pieces").);.}.catch
0ca0 20 28 54 79 70 65 45 72 72 6f 72 20 24 65 29 20 7b 0a 20 20 20 20 65 63 68 6f 20 24 65 2d 3e 67 .(TypeError.$e).{.....echo.$e->g
0cc0 65 74 4d 65 73 73 61 67 65 28 29 2c 20 22 5c 6e 22 3b 0a 7d 0a 0a 2f 2a 20 4e 55 4c 4c 20 61 73 etMessage(),."\n";.}../*.NULL.as
0ce0 20 67 6c 75 65 20 2a 2f 0a 74 72 79 20 7b 0a 20 20 20 20 76 61 72 5f 64 75 6d 70 28 20 69 6d 70 .glue.*/.try.{.....var_dump(.imp
0d00 6c 6f 64 65 28 4e 55 4c 4c 2c 20 22 61 62 63 64 22 29 20 29 3b 0a 7d 20 63 61 74 63 68 20 28 54 lode(NULL,."abcd").);.}.catch.(T
0d20 79 70 65 45 72 72 6f 72 20 24 65 29 20 7b 0a 20 20 20 20 65 63 68 6f 20 24 65 2d 3e 67 65 74 4d ypeError.$e).{.....echo.$e->getM
0d40 65 73 73 61 67 65 28 29 2c 20 22 5c 6e 22 3b 0a 7d 0a 0a 2f 2a 20 63 6c 6f 73 69 6e 67 20 72 65 essage(),."\n";.}../*.closing.re
0d60 73 6f 75 72 63 65 20 68 61 6e 64 6c 65 73 20 2a 2f 0a 66 63 6c 6f 73 65 28 24 66 69 6c 65 5f 68 source.handles.*/.fclose($file_h
0d80 61 6e 64 6c 65 29 3b 0a 63 6c 6f 73 65 64 69 72 28 24 64 69 72 5f 68 61 6e 64 6c 65 29 3b 0a 0a andle);.closedir($dir_handle);..
0da0 65 63 68 6f 20 22 44 6f 6e 65 5c 6e 22 3b 0a 3f 3e 0a 2d 2d 45 58 50 45 43 54 46 2d 2d 0a 2a 2a echo."Done\n";.?>.--EXPECTF--.**
0dc0 2a 20 54 65 73 74 69 6e 67 20 69 6d 70 6c 6f 64 65 28 29 20 66 6f 72 20 62 61 73 69 63 20 6f 70 *.Testing.implode().for.basic.op
0de0 65 72 61 74 69 6f 6e 73 20 2a 2a 2a 0a 73 74 72 69 6e 67 28 34 29 20 22 31 2c 20 32 22 0a 61 72 erations.***.string(4)."1,.2".ar
0e00 72 61 79 28 32 29 20 7b 0a 20 20 5b 30 5d 3d 3e 0a 20 20 69 6e 74 28 31 29 0a 20 20 5b 31 5d 3d ray(2).{...[0]=>...int(1)...[1]=
0e20 3e 0a 20 20 69 6e 74 28 32 29 0a 7d 0a 73 74 72 69 6e 67 28 38 29 20 22 31 2e 31 2c 20 32 2e 32 >...int(2).}.string(8)."1.1,.2.2
0e40 22 0a 61 72 72 61 79 28 32 29 20 7b 0a 20 20 5b 30 5d 3d 3e 0a 20 20 66 6c 6f 61 74 28 31 2e 31 ".array(2).{...[0]=>...float(1.1
0e60 29 0a 20 20 5b 31 5d 3d 3e 0a 20 20 66 6c 6f 61 74 28 32 2e 32 29 0a 7d 0a 0a 57 61 72 6e 69 6e )...[1]=>...float(2.2).}..Warnin
0e80 67 3a 20 41 72 72 61 79 20 74 6f 20 73 74 72 69 6e 67 20 63 6f 6e 76 65 72 73 69 6f 6e 20 69 6e g:.Array.to.string.conversion.in
0ea0 20 25 73 20 6f 6e 20 6c 69 6e 65 20 25 64 0a 0a 57 61 72 6e 69 6e 67 3a 20 41 72 72 61 79 20 74 .%s.on.line.%d..Warning:.Array.t
0ec0 6f 20 73 74 72 69 6e 67 20 63 6f 6e 76 65 72 73 69 6f 6e 20 69 6e 20 25 73 20 6f 6e 20 6c 69 6e o.string.conversion.in.%s.on.lin
0ee0 65 20 25 64 0a 73 74 72 69 6e 67 28 31 32 29 20 22 41 72 72 61 79 2c 20 41 72 72 61 79 22 0a 61 e.%d.string(12)."Array,.Array".a
0f00 72 72 61 79 28 32 29 20 7b 0a 20 20 5b 30 5d 3d 3e 0a 20 20 61 72 72 61 79 28 31 29 20 7b 0a 20 rray(2).{...[0]=>...array(1).{..
0f20 20 20 20 5b 30 5d 3d 3e 0a 20 20 20 20 69 6e 74 28 32 29 0a 20 20 7d 0a 20 20 5b 31 5d 3d 3e 0a ...[0]=>.....int(2)...}...[1]=>.
0f40 20 20 61 72 72 61 79 28 31 29 20 7b 0a 20 20 20 20 5b 30 5d 3d 3e 0a 20 20 20 20 69 6e 74 28 31 ..array(1).{.....[0]=>.....int(1
0f60 29 0a 20 20 7d 0a 7d 0a 73 74 72 69 6e 67 28 33 29 20 22 2c 20 31 22 0a 61 72 72 61 79 28 32 29 )...}.}.string(3).",.1".array(2)
0f80 20 7b 0a 20 20 5b 30 5d 3d 3e 0a 20 20 62 6f 6f 6c 28 66 61 6c 73 65 29 0a 20 20 5b 31 5d 3d 3e .{...[0]=>...bool(false)...[1]=>
0fa0 0a 20 20 62 6f 6f 6c 28 74 72 75 65 29 0a 7d 0a 73 74 72 69 6e 67 28 30 29 20 22 22 0a 61 72 72 ...bool(true).}.string(0)."".arr
0fc0 61 79 28 30 29 20 7b 0a 7d 0a 73 74 72 69 6e 67 28 34 32 29 20 22 61 2c 20 61 61 61 61 2c 20 62 ay(0).{.}.string(42)."a,.aaaa,.b
0fe0 2c 20 62 62 62 62 2c 20 63 2c 20 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 ,.bbbb,.c,.ccccccccccccccccccccc
1000 22 0a 61 72 72 61 79 28 36 29 20 7b 0a 20 20 5b 30 5d 3d 3e 0a 20 20 73 74 72 69 6e 67 28 31 29 ".array(6).{...[0]=>...string(1)
1020 20 22 61 22 0a 20 20 5b 31 5d 3d 3e 0a 20 20 73 74 72 69 6e 67 28 34 29 20 22 61 61 61 61 22 0a ."a"...[1]=>...string(4)."aaaa".
1040 20 20 5b 32 5d 3d 3e 0a 20 20 73 74 72 69 6e 67 28 31 29 20 22 62 22 0a 20 20 5b 33 5d 3d 3e 0a ..[2]=>...string(1)."b"...[3]=>.
1060 20 20 73 74 72 69 6e 67 28 34 29 20 22 62 62 62 62 22 0a 20 20 5b 34 5d 3d 3e 0a 20 20 73 74 72 ..string(4)."bbbb"...[4]=>...str
1080 69 6e 67 28 31 29 20 22 63 22 0a 20 20 5b 35 5d 3d 3e 0a 20 20 73 74 72 69 6e 67 28 32 31 29 20 ing(1)."c"...[5]=>...string(21).
10a0 22 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 22 0a 7d 0a 0a 2a 2a 2a 20 54 "ccccccccccccccccccccc".}..***.T
10c0 65 73 74 69 6e 67 20 69 6d 70 6c 6f 64 65 28 29 20 77 69 74 68 20 76 61 72 69 61 74 69 6f 6e 73 esting.implode().with.variations
10e0 20 6f 66 20 67 6c 75 65 20 2a 2a 2a 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 31 20 2d 2d 0a 73 .of.glue.***.--.Iteration.1.--.s
1100 74 72 69 6e 67 28 36 33 29 20 22 32 54 52 55 45 30 54 52 55 45 2d 36 33 39 54 52 55 45 31 54 52 tring(63)."2TRUE0TRUE-639TRUE1TR
1120 55 45 50 48 50 54 52 55 45 54 52 55 45 54 52 55 45 54 52 55 45 20 54 52 55 45 73 74 72 69 6e 67 UEPHPTRUETRUETRUETRUE.TRUEstring
1140 00 77 69 74 68 00 2e 2e 2e 00 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 32 20 2d 2d 0a 73 74 .with.....".--.Iteration.2.--.st
1160 72 69 6e 67 28 33 36 29 20 22 32 31 30 31 2d 36 33 39 31 31 31 50 48 50 31 31 31 31 20 31 73 74 ring(36)."2101-639111PHP1111.1st
1180 72 69 6e 67 00 77 69 74 68 00 2e 2e 2e 00 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 33 20 2d ring.with.....".--.Iteration.3.-
11a0 2d 0a 73 74 72 69 6e 67 28 32 37 29 20 22 32 30 2d 36 33 39 31 50 48 50 20 73 74 72 69 6e 67 00 -.string(27)."20-6391PHP.string.
11c0 77 69 74 68 00 2e 2e 2e 00 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 34 20 2d 2d 0a 69 6d 70 with.....".--.Iteration.4.--.imp
11e0 6c 6f 64 65 28 29 3a 20 41 72 67 75 6d 65 6e 74 20 23 31 20 28 24 67 6c 75 65 29 20 6d 75 73 74 lode():.Argument.#1.($glue).must
1200 20 62 65 20 6f 66 20 74 79 70 65 20 73 74 72 69 6e 67 2c 20 61 72 72 61 79 20 67 69 76 65 6e 0a .be.of.type.string,.array.given.
1220 2d 2d 20 49 74 65 72 61 74 69 6f 6e 20 35 20 2d 2d 0a 73 74 72 69 6e 67 28 32 37 29 20 22 32 30 --.Iteration.5.--.string(27)."20
1240 2d 36 33 39 31 50 48 50 20 73 74 72 69 6e 67 00 77 69 74 68 00 2e 2e 2e 00 22 0a 2d 2d 20 49 74 -6391PHP.string.with.....".--.It
1260 65 72 61 74 69 6f 6e 20 36 20 2d 2d 0a 73 74 72 69 6e 67 28 33 36 29 20 22 32 20 30 20 2d 36 33 eration.6.--.string(36)."2.0.-63
1280 39 20 31 20 50 48 50 20 20 20 20 20 20 73 74 72 69 6e 67 00 77 69 74 68 00 2e 2e 2e 00 22 0a 2d 9.1.PHP......string.with.....".-
12a0 2d 20 49 74 65 72 61 74 69 6f 6e 20 37 20 2d 2d 0a 73 74 72 69 6e 67 28 31 35 33 29 20 22 32 73 -.Iteration.7.--.string(153)."2s
12c0 74 72 69 6e 67 00 62 65 74 77 65 65 6e 30 73 74 72 69 6e 67 00 62 65 74 77 65 65 6e 2d 36 33 39 tring.between0string.between-639
12e0 73 74 72 69 6e 67 00 62 65 74 77 65 65 6e 31 73 74 72 69 6e 67 00 62 65 74 77 65 65 6e 50 48 50 string.between1string.betweenPHP
1300 73 74 72 69 6e 67 00 62 65 74 77 65 65 6e 73 74 72 69 6e 67 00 62 65 74 77 65 65 6e 73 74 72 69 string.betweenstring.betweenstri
1320 6e 67 00 62 65 74 77 65 65 6e 73 74 72 69 6e 67 00 62 65 74 77 65 65 6e 20 73 74 72 69 6e 67 00 ng.betweenstring.between.string.
1340 62 65 74 77 65 65 6e 73 74 72 69 6e 67 00 77 69 74 68 00 2e 2e 2e 00 22 0a 2d 2d 20 49 74 65 72 betweenstring.with.....".--.Iter
1360 61 74 69 6f 6e 20 38 20 2d 2d 0a 73 74 72 69 6e 67 28 32 37 29 20 22 32 30 2d 36 33 39 31 50 48 ation.8.--.string(27)."20-6391PH
1380 50 20 73 74 72 69 6e 67 00 77 69 74 68 00 2e 2e 2e 00 22 0a 2d 2d 20 49 74 65 72 61 74 69 6f 6e P.string.with.....".--.Iteration
13a0 20 39 20 2d 2d 0a 73 74 72 69 6e 67 28 33 36 29 20 22 32 30 30 30 2d 36 33 39 30 31 30 50 48 50 .9.--.string(36)."2000-639010PHP
13c0 30 30 30 30 20 30 73 74 72 69 6e 67 00 77 69 74 68 00 2e 2e 2e 00 22 0a 2d 2d 20 49 74 65 72 61 0000.0string.with.....".--.Itera
13e0 74 69 6f 6e 20 31 30 20 2d 2d 0a 73 74 72 69 6e 67 28 34 35 29 20 22 32 5c 30 30 5c 30 2d 36 33 tion.10.--.string(45)."2\00\0-63
1400 39 5c 30 31 5c 30 50 48 50 5c 30 5c 30 5c 30 5c 30 20 5c 30 73 74 72 69 6e 67 00 77 69 74 68 00 9\01\0PHP\0\0\0\0.\0string.with.
1420 2e 2e 2e 00 22 0a 0a 2a 2a 2a 20 54 65 73 74 69 6e 67 20 69 6d 70 6c 6f 64 65 28 29 20 6f 6e 20 ...."..***.Testing.implode().on.
1440 65 6d 70 74 79 20 73 74 72 69 6e 67 20 2a 2a 2a 0a 69 6d 70 6c 6f 64 65 28 29 3a 20 41 72 67 75 empty.string.***.implode():.Argu
1460 6d 65 6e 74 20 23 31 20 28 24 70 69 65 63 65 73 29 20 6d 75 73 74 20 62 65 20 6f 66 20 74 79 70 ment.#1.($pieces).must.be.of.typ
1480 65 20 61 72 72 61 79 2c 20 73 74 72 69 6e 67 20 67 69 76 65 6e 0a 0a 2a 2a 2a 20 54 65 73 74 69 e.array,.string.given..***.Testi
14a0 6e 67 20 69 6d 70 6c 6f 64 65 28 29 20 6f 6e 20 73 75 62 2d 61 72 72 61 79 73 20 2a 2a 2a 0a 0a ng.implode().on.sub-arrays.***..
14c0 57 61 72 6e 69 6e 67 3a 20 41 72 72 61 79 20 74 6f 20 73 74 72 69 6e 67 20 63 6f 6e 76 65 72 73 Warning:.Array.to.string.convers
14e0 69 6f 6e 20 69 6e 20 25 73 20 6f 6e 20 6c 69 6e 65 20 25 64 0a 0a 57 61 72 6e 69 6e 67 3a 20 41 ion.in.%s.on.line.%d..Warning:.A
1500 72 72 61 79 20 74 6f 20 73 74 72 69 6e 67 20 63 6f 6e 76 65 72 73 69 6f 6e 20 69 6e 20 25 73 20 rray.to.string.conversion.in.%s.
1520 6f 6e 20 6c 69 6e 65 20 25 64 0a 73 74 72 69 6e 67 28 32 37 29 20 22 41 72 72 61 79 54 45 53 54 on.line.%d.string(27)."ArrayTEST
1540 41 72 72 61 79 54 45 53 54 50 48 50 54 45 53 54 35 30 22 0a 69 6d 70 6c 6f 64 65 28 29 3a 20 41 ArrayTESTPHPTEST50".implode():.A
1560 72 67 75 6d 65 6e 74 20 23 31 20 28 24 67 6c 75 65 29 20 6d 75 73 74 20 62 65 20 6f 66 20 74 79 rgument.#1.($glue).must.be.of.ty
1580 70 65 20 73 74 72 69 6e 67 2c 20 61 72 72 61 79 20 67 69 76 65 6e 0a 0a 57 61 72 6e 69 6e 67 3a pe.string,.array.given..Warning:
15a0 20 41 72 72 61 79 20 74 6f 20 73 74 72 69 6e 67 20 63 6f 6e 76 65 72 73 69 6f 6e 20 69 6e 20 25 .Array.to.string.conversion.in.%
15c0 73 0a 0a 57 61 72 6e 69 6e 67 3a 20 41 72 72 61 79 20 74 6f 20 73 74 72 69 6e 67 20 63 6f 6e 76 s..Warning:.Array.to.string.conv
15e0 65 72 73 69 6f 6e 20 69 6e 20 25 73 0a 73 74 72 69 6e 67 28 31 38 29 20 22 41 72 72 61 79 32 41 ersion.in.%s.string(18)."Array2A
1600 72 72 61 79 32 50 48 50 32 35 30 22 0a 0a 2a 2a 2a 20 54 65 73 74 69 6e 67 20 69 6d 70 6c 6f 64 rray2PHP250"..***.Testing.implod
1620 65 28 29 20 6f 6e 20 6f 62 6a 65 63 74 73 20 2a 2a 2a 0a 73 74 72 69 6e 67 28 31 33 29 20 22 4f e().on.objects.***.string(13)."O
1640 62 6a 65 63 74 2c 4f 62 6a 65 63 74 22 0a 61 72 72 61 79 28 32 29 20 7b 0a 20 20 5b 30 5d 3d 3e bject,Object".array(2).{...[0]=>
1660 0a 20 20 26 6f 62 6a 65 63 74 28 66 6f 6f 29 23 25 64 20 28 30 29 20 7b 0a 20 20 7d 0a 20 20 5b ...&object(foo)#%d.(0).{...}...[
1680 31 5d 3d 3e 0a 20 20 26 6f 62 6a 65 63 74 28 66 6f 6f 29 23 25 64 20 28 30 29 20 7b 0a 20 20 7d 1]=>...&object(foo)#%d.(0).{...}
16a0 0a 7d 0a 0a 2a 2a 2a 20 54 65 73 74 69 6e 67 20 65 6e 64 28 29 20 6f 6e 20 72 65 73 6f 75 72 63 .}..***.Testing.end().on.resourc
16c0 65 20 74 79 70 65 20 2a 2a 2a 0a 73 74 72 69 6e 67 28 25 64 29 20 22 52 65 73 6f 75 72 63 65 20 e.type.***.string(%d)."Resource.
16e0 69 64 20 23 25 64 3a 3a 52 65 73 6f 75 72 63 65 20 69 64 20 23 25 64 22 0a 0a 2a 2a 2a 20 54 65 id.#%d::Resource.id.#%d"..***.Te
1700 73 74 69 6e 67 20 65 72 72 6f 72 20 63 6f 6e 64 69 74 69 6f 6e 73 20 2a 2a 2a 0a 69 6d 70 6c 6f sting.error.conditions.***.implo
1720 64 65 28 29 3a 20 41 72 67 75 6d 65 6e 74 20 23 31 20 28 24 70 69 65 63 65 73 29 20 6d 75 73 74 de():.Argument.#1.($pieces).must
1740 20 62 65 20 6f 66 20 74 79 70 65 20 61 72 72 61 79 2c 20 73 74 72 69 6e 67 20 67 69 76 65 6e 0a .be.of.type.array,.string.given.
1760 69 6d 70 6c 6f 64 65 28 29 3a 20 41 72 67 75 6d 65 6e 74 20 23 32 20 28 24 70 69 65 63 65 73 29 implode():.Argument.#2.($pieces)
1780 20 6d 75 73 74 20 62 65 20 6f 66 20 74 79 70 65 20 61 72 72 61 79 2c 20 69 6e 74 20 67 69 76 65 .must.be.of.type.array,.int.give
17a0 6e 0a 69 6d 70 6c 6f 64 65 28 29 3a 20 41 72 67 75 6d 65 6e 74 20 23 32 20 28 24 70 69 65 63 65 n.implode():.Argument.#2.($piece
17c0 73 29 20 6d 75 73 74 20 62 65 20 6f 66 20 74 79 70 65 20 61 72 72 61 79 2c 20 6e 75 6c 6c 20 67 s).must.be.of.type.array,.null.g
17e0 69 76 65 6e 0a 73 74 72 69 6e 67 28 30 29 20 22 22 0a 69 6d 70 6c 6f 64 65 28 29 3a 20 41 72 67 iven.string(0)."".implode():.Arg
1800 75 6d 65 6e 74 20 23 32 20 28 24 70 69 65 63 65 73 29 20 6d 75 73 74 20 62 65 20 6f 66 20 74 79 ument.#2.($pieces).must.be.of.ty
1820 70 65 20 61 72 72 61 79 2c 20 73 74 72 69 6e 67 20 67 69 76 65 6e 0a 69 6d 70 6c 6f 64 65 28 29 pe.array,.string.given.implode()
1840 3a 20 41 72 67 75 6d 65 6e 74 20 23 32 20 28 24 70 69 65 63 65 73 29 20 6d 75 73 74 20 62 65 20 :.Argument.#2.($pieces).must.be.
1860 6f 66 20 74 79 70 65 20 61 72 72 61 79 2c 20 73 74 72 69 6e 67 20 67 69 76 65 6e 0a 44 6f 6e 65 of.type.array,.string.given.Done
1880 0a .