3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = ' Image: /tmp/magick-30622tK1TVEy4qQ1z.png Base filename: 1540228221.CR2 Format: CR2 (Canon Digital Camera Raw Image Format) Class: DirectClass Geometry: 5208x3476+0+0 Units: Undefined Type: TrueColor Endianess: Undefined Colorspace: sRGB Depth: 16-bit Channel depth: red: 16-bit green: 16-bit blue: 16-bit Channel statistics: Pixels: 18103008 Red: min: 0 (0) max: 65535 (1) mean: 25528.4 (0.389538) standard deviation: 15529 (0.236957) kurtosis: -1.02417 skewness: 0.396123 Green: min: 0 (0) max: 65535 (1) mean: 24575.9 (0.375004) standard deviation: 15639.2 (0.238638) kurtosis: -0.683949 skewness: 0.634641 Blue: min: 0 (0) max: 65535 (1) mean: 20208.1 (0.308355) standard deviation: 18589.9 (0.283664) kurtosis: -0.117841 skewness: 1.15446 Image statistics: Overall: min: 0 (0) max: 65535 (1) mean: 23437.4 (0.357632) standard deviation: 16646.5 (0.254009) kurtosis: -0.589458 skewness: 0.744626 Rendering intent: Perceptual Gamma: 0.454545 Chromaticity: red primary: (0.64,0.33) green primary: (0.3,0.6) blue primary: (0.15,0.06) white point: (0.3127,0.329) Background color: white Border color: srgb(223,223,223) Matte color: grey74 Transparent color: black Interlace: None Intensity: Undefined Compose: Over Page geometry: 5208x3476+0+0 Dispose: Undefined Iterations: 0 Compression: Zip Orientation: TopLeft Properties: date:create: 2018-10-22T17:10:37+00:00 date:modify: 2018-10-22T17:10:37+00:00 dng:Aperture: F5.6 dng:AspectRatio: 1.498274 dng:ChannelMultipliers: 2.0546 1.0000 1.5410 1.0000 dng:CreateID: 1 dng:Crop: 0 0 5208 3476 dng:EXIFSource: exiv2 0.25 dng:ExposureNorm: 30085 dng:FocalLength: 15.0 mm dng:Green: 1.056 dng:ISOSpeed: 125 dng:Lens: (4153) dng:Make: Canon dng:MatrixInputProfile: Color matrix dng:Model: EOS M10 dng:Orientation: 0 dng:Rotation: 0.000000 dng:Shutter: 1/160 s dng:sRGBOutputProfile: sRGB dng:Temperature: 5534 dng:Timestamp: Thu Aug 23 17:56:08 2018 dng:WB: Camera WB dng:WBFineTuning: 0 exif:ApertureValue: 159/32 exif:Artist: exif:ColorSpace: 1 exif:ComponentsConfiguration: 1, 2, 3, 0 exif:CompressedBitsPerPixel: 3/1 exif:Copyright: exif:CustomRendered: 0 exif:DateTime: 2018:08:23 17:56:08 exif:DateTimeDigitized: 2018:08:23 17:56:08 exif:DateTimeOriginal: 2018:08:23 17:56:08 exif:DigitalZoomRatio: 5184/5184 exif:ExifImageLength: 3456 exif:ExifImageWidth: 5184 exif:ExifOffset: 218 exif:ExifVersion: 48, 50, 51, 48 exif:ExposureBiasValue: 0/3 exif:ExposureMode: 0 exif:ExposureProgram: 2 exif:ExposureTime: 1/160 exif:FileSource: 3 exif:Flash: 16 exif:FlashPixVersion: 48, 49, 48, 48 exif:FNumber: 56/10 exif:FocalLength: 15/1 exif:FocalPlaneResolutionUnit: 2 exif:FocalPlaneXResolution: 5184000/878 exif:FocalPlaneYResolution: 3456000/585 exif:GPSInfo: 40916 exif:GPSVersionID: 2, 3, 0, 0 exif:ImageDescription: exif:InteroperabilityOffset: 40862 exif:ISOSpeedRatings: 125 exif:Make: Canon exif:MakerNote: 0, 50, 0, 1, 0, 3, 0, 0, 0, 50, 0, 0, 5, 150, 0, 3, 0, 3, 0, 0, 0, 4, 0, 0, 5, 250, 0, 4, 0, 3, 0, 0, 0, 34, 0, 0, 6, 2, 0, 6, 0, 2, 0, 0, 0, 26, 0, 0, 6, 70, 0, 7, 0, 2, 0, 0, 0, 22, 0, 0, 6, 96, 0, 8, 0, 4, 0, 0, 0, 1, 0, 36, 200, 143, 0, 13, 0, 4, 0, 0, 14, 102, 0, 0, 6, 118, 0, 16, 0, 4, 0, 0, 0, 1, 3, 132, 0, 0, 0, 19, 0, 3, 0, 0, 0, 4, 0, 0, 64, 14, 0, 24, 0, 1, 0, 0, 1, 0, 0, 0, 64, 22, 0, 25, 0, 3, 0, 0, 0, 1, 0, 1, 0, 0, 0, 28, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 30, 0, 4, 0, 0, 0, 1, 1, 16, 6, 0, 0, 35, 0, 4, 0, 0, 0, 2, 0, 0, 65, 22, 0, 39, 0, 3, 0, 0, 0, 21, 0, 0, 65, 30, 0, 40, 0, 1, 0, 0, 0, 16, 0, 0, 65, 72, 0, 45, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 46, 0, 3, 0, 0, 0, 29, 0, 0, 65, 88, 0, 47, 0, 3, 0, 0, 0, 17, 0, 0, 65, 146, 0, 49, 0, 3, 0, 0, 0, 6, 0, 0, 65, 180, 0, 51, 0, 4, 0, 0, 0, 4, 0, 0, 65, 192, 0, 53, 0, 4, 0, 0, 0, 4, 0, 0, 65, 208, 0, 54, 0, 3, 0, 0, 0, 12, 0, 0, 65, 224, 0, 64, 0, 4, 0, 0, 0, 2, 0, 0, 65, 248, 0, 56, 0, 7, 0, 0, 0, 8, 0, 0, 66, 0, 0, 60, 0, 3, 0, 0, 0, 218, 0, 0, 66, 8, 0, 61, 0, 4, 0, 0, 0, 8, 0, 0, 67, 188, 0, 63, 0, 4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 147, 0, 3, 0, 0, 0, 33, 0, 0, 67, 220, 0, 150, 0, 2, 0, 0, 0, 10, 0, 0, 68, 30, 0, 153, 0, 4, 0, 0, 0, 34, 0, 0, 68, 40, 0, 154, 0, 4, 0, 0, 0, 5, 0, 0, 68, 176, 0, 160, 0, 3, 0, 0, 0, 14, 0, 0, 68, 196, 0, 170, 0, 3, 0, 0, 0, 6, 0, 0, 68, 224, 0, 208, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 224, 0, 3, 0, 0, 0, 17, 0, 0, 68, 236, 64, 1, 0, 7, 0, 0, 20, 0, 0, 0, 69, 14, 64, 5, 0, 7, 0, 0, 65, 156, 0, 0, 89, 14, 64, 8, 0, 3, 0, 0, 0, 3, 0, 0, 154, 170, 64, 9, 0, 3, 0, 0, 0, 3, 0, 0, 154, 176, 64, 16, 0, 2, 0, 0, 0, 32, 0, 0, 154, 182, 64, 18, 0, 2, 0, 0, 0, 32, 0, 0, 154, 214, 64, 21, 0, 7, 0, 0, 1, 204, 0, 0, 154, 246, 64, 22, 0, 4, 0, 0, 0, 8, 0, 0, 156, 194, 64, 24, 0, 4, 0, 0, 0, 9, 0, 0, 156, 226, 64, 32, 0, 4, 0, 0, 0, 7, 0, 0, 157, 6, 64, 35, 0, 4, 0, 0, 0, 4, 0, 0, 157, 34, 64, 36, 0, 4, 0, 0, 0, 53, 0, 0, 157, 50, 64, 43, 0, 4, 0, 0, 0, 6, 0, 0, 158, 6, 64, 44, 0, 4, 0, 0, 0, 2, 0, 0, 158, 30, 0, 0, 0, 0, 0, 100, 0, 2, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 6, 255, 255, 0, 83, 0, 0, 0, 0, 0, 0, 127, 255, 0, 15, 0, 3, 0, 1, 64, 6, 0, 0, 127, 255, 16, 57, 0, 45, 0, 15, 0, 1, 0, 116, 1, 29, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 1, 1, 0, 116, 20, 64, 20, 64, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 127, 255, 0, 0, 0, 0, 0, 0, 0, 160, 255, 255, 0, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 255, 236, 0, 192, 0, 222, 0, 159, 0, 234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 159, 0, 232, 0, 0, 0, 0, 0, 2, 0, 250, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 77, 71, 58, 72, 105, 103, 104, 32, 100, 101, 102, 105, 110, 105, 116, 105, 111, 110, 32, 105, 109, 97, 103, 101, 0, 70, 105, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 212, 0, 0, 2, 184, 255, 255, 255, 196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 92, 0, 0, 3, 15, 255, 255, 255, 160, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 25 exif:MeteringMode: 5 exif:Model: Canon EOS M10 exif:Orientation: 1 exif:SceneCaptureType: 0 exif:SensingMethod: 2 exif:ShutterSpeedValue: 234/32 exif:SubSecTime: 00 exif:SubSecTimeDigitized: 00 exif:SubSecTimeOriginal: 00 exif:thumbnail:InteroperabilityIndex: R98 exif:thumbnail:InteroperabilityVersion: 48, 49, 48, 48 exif:thumbnail:JPEGInterchangeFormat: 40964 exif:thumbnail:JPEGInterchangeFormatLength: 15681 exif:thumbnail:RelatedImageLength: 5184 exif:thumbnail:RelatedImageWidth: 3456 exif:UserComment: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 exif:WhiteBalance: 0 png:IHDR.bit-depth-orig: 16 png:IHDR.bit_depth: 16 png:IHDR.color-type-orig: 2 png:IHDR.color_type: 2 (Truecolor) png:IHDR.interlace_method: 0 (Not interlaced) png:IHDR.width,height: 5208, 3476 png:sRGB: intent=0 (Perceptual Intent) png:text: 3 tEXt/zTXt/iTXt chunks were found png:text-encoded profiles: 1 were found signature: ec0f6a1cfddabb6ce506e487fdaa318b8f1830721726aca5aa72b06e07aaf188 Software: UFRaw Source: CanonEOS M10 unknown: UFRaw 0.20 Profiles: Profile-exif: 56652 bytes Artifacts: filename: /srv/users/serverpilot/apps/cms-suha-rocks/cms/webroot/photos/1540228221.CR2 verbose: true Tainted: False Filesize: 93.31MB Number pixels: 18.1M Pixels per second: 8.62MB User time: 2.100u Elapsed time: 0:03.100 Version: ImageMagick 6.8.9-9 Q16 x86_64 2018-09-28 http://www.imagemagick.org '; $key = ''; $arr = []; foreach(preg_split("/((\r?\n)|(\r\n?))/", $str) as $line){ if(trim($line) !== "") { $level = ' '; $levelOfLine = strripos($line, $level); if($levelOfLine === false) { $key = explode(':', $line)[0]; $arr[$key]['_self'] = str_ireplace($key.':', '', $line); } else { $subLevel = $levelOfLine / 2; if($subLevel === 0) { $subkey = explode(':', $line)[0]; $arr[$key][trim($subkey)]['_self'] = str_ireplace($subkey.':', '', $line); } if($subLevel > 0) { $subMorekey = explode(':', $line)[0]; $arr[$key][trim($subkey)][trim($subMorekey)] = str_ireplace($subMorekey.':', '', $line); } } } } print_r($arr);
Output for 7.3.0rc3
Array ( [Image] => Array ( [_self] => /tmp/magick-30622tK1TVEy4qQ1z.png [Base filename] => Array ( [_self] => 1540228221.CR2 ) [Format] => Array ( [_self] => CR2 (Canon Digital Camera Raw Image Format) ) [Class] => Array ( [_self] => DirectClass ) [Geometry] => Array ( [_self] => 5208x3476+0+0 ) [Units] => Array ( [_self] => Undefined ) [Type] => Array ( [_self] => TrueColor ) [Endianess] => Array ( [_self] => Undefined ) [Colorspace] => Array ( [_self] => sRGB ) [Depth] => Array ( [_self] => 16-bit ) [Channel depth] => Array ( [_self] => [red] => 16-bit [green] => 16-bit [blue] => 16-bit ) [Channel statistics] => Array ( [_self] => [Pixels] => 18103008 [Red] => [min] => 0 (0) [max] => 65535 (1) [mean] => 20208.1 (0.308355) [standard deviation] => 18589.9 (0.283664) [kurtosis] => -0.117841 [skewness] => 1.15446 [Green] => [Blue] => ) [Image statistics] => Array ( [_self] => [Overall] => [min] => 0 (0) [max] => 65535 (1) [mean] => 23437.4 (0.357632) [standard deviation] => 16646.5 (0.254009) [kurtosis] => -0.589458 [skewness] => 0.744626 ) [Rendering intent] => Array ( [_self] => Perceptual ) [Gamma] => Array ( [_self] => 0.454545 ) [Chromaticity] => Array ( [_self] => [red primary] => (0.64,0.33) [green primary] => (0.3,0.6) [blue primary] => (0.15,0.06) [white point] => (0.3127,0.329) ) [Background color] => Array ( [_self] => white ) [Border color] => Array ( [_self] => srgb(223,223,223) ) [Matte color] => Array ( [_self] => grey74 ) [Transparent color] => Array ( [_self] => black ) [Interlace] => Array ( [_self] => None ) [Intensity] => Array ( [_self] => Undefined ) [Compose] => Array ( [_self] => Over ) [Page geometry] => Array ( [_self] => 5208x3476+0+0 ) [Dispose] => Array ( [_self] => Undefined ) [Iterations] => Array ( [_self] => 0 ) [Compression] => Array ( [_self] => Zip ) [Orientation] => Array ( [_self] => TopLeft ) [Properties] => Array ( [_self] => [date] => modify: 2018-10-22T17:10:37+00:00 [dng] => WBFineTuning: 0 [exif] => WhiteBalance: 0 [png] => text-encoded profiles: 1 were found [signature] => ec0f6a1cfddabb6ce506e487fdaa318b8f1830721726aca5aa72b06e07aaf188 [Software] => UFRaw [Source] => CanonEOS M10 [unknown] => UFRaw 0.20 ) [Profiles] => Array ( [_self] => [Profile-exif] => 56652 bytes ) [Artifacts] => Array ( [_self] => [filename] => /srv/users/serverpilot/apps/cms-suha-rocks/cms/webroot/photos/1540228221.CR2 [verbose] => true ) [Tainted] => Array ( [_self] => False ) [Filesize] => Array ( [_self] => 93.31MB ) [Number pixels] => Array ( [_self] => 18.1M ) [Pixels per second] => Array ( [_self] => 8.62MB ) [User time] => Array ( [_self] => 2.100u ) [Elapsed time] => Array ( [_self] => 0:03.100 ) [Version] => Array ( [_self] => ImageMagick 6.8.9-9 Q16 x86_64 2018-09-28 http://www.imagemagick.org ) ) )