3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In tristique nisi nibh, sit amet vehicula eros aliquam ut. Phasellus ac mauris vehicula, viverra quam vel, sodales lectus. Duis pharetra massa in mollis rhoncus. Praesent pretium sodales pretium. Donec luctus, massa sit amet lacinia feugiat, massa massa bibendum elit, vel euismod felis erat quis diam. Nunc mollis tortor mi, cursus rutrum neque sollicitudin quis. Vestibulum aliquet viverra nibh, dapibus adipiscing magna cursus eget. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin placerat, nisl eu mattis interdum, mi metus vehicula tortor, eget consequat mi sem vitae tellus. Phasellus varius leo nec porta elementum. Duis pulvinar imperdiet diam eget ultricies. Suspendisse vestibulum viverra magna, at ornare tellus gravida in. Phasellus aliquet odio et aliquet cursus. Mauris id neque at arcu pulvinar sollicitudin et at mauris. Vestibulum vitae lobortis metus. Proin ac mauris ante. Mauris ac libero quis odio facilisis egestas nec ac urna. Donec euismod ligula nec enim aliquam, nec feugiat dolor ultricies. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In rhoncus ipsum a justo lacinia, et pulvinar felis mollis. Aenean cursus rutrum erat vel dictum. Nunc elit nulla, aliquam non porttitor nec, tincidunt eu lacus. Cras tempor augue purus, eleifend aliquet justo ultricies id. Interdum et malesuada fames ac ante ipsum primis in faucibus. Mauris at elit sagittis, posuere augue et, porta lorem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum fermentum nibh enim, et pulvinar magna mollis sit amet. Integer tristique suscipit sem, cursus eleifend nunc commodo ac. Quisque felis risus, bibendum in accumsan tincidunt, venenatis eu sem. Donec sed felis viverra, varius arcu vitae, commodo ante. Sed faucibus ac metus in commodo. Proin enim mauris, interdum a sapien at, ornare commodo diam. Sed a ante imperdiet, fringilla lacus ac, congue nibh. Nunc non vulputate nunc. Sed pharetra commodo tellus id tristique. Etiam sed elit sit amet lorem tristique euismod non ut neque. Morbi id dignissim mauris. Nullam commodo vulputate molestie. Suspendisse eu ligula aliquet, accumsan risus ac, elementum lectus. Donec id nisl sed felis auctor mollis eu gravida justo. Vestibulum sed adipiscing dui, non imperdiet turpis. In hac habitasse platea dictumst. Vestibulum convallis diam quis augue ultrices, mattis adipiscing leo ultricies. Curabitur gravida, lacus at facilisis faucibus, enim tortor vestibulum sem, quis vestibulum nunc felis at augue. Ut imperdiet diam ac metus ultrices ullamcorper. Cras nec tortor id ante tempor feugiat. Sed placerat, est in tristique rhoncus, erat neque condimentum magna, tincidunt euismod ipsum nisl vitae sapien. Donec et consequat arcu, eu ultricies purus. Ut eget turpis sed est aliquet tristique. Nulla lectus nibh, commodo eu dui eget, commodo euismod urna. Nunc nec mollis felis, eget ultricies diam. Aliquam suscipit mauris at lorem convallis condimentum. Donec suscipit erat ut cursus lobortis. Curabitur ac velit non dui porta pulvinar at sit amet neque. Cras luctus lorem vel justo mattis pharetra. Aenean vestibulum lectus est, sed consectetur est posuere eu. Fusce vehicula tristique mattis. Nam in mattis mi. Cras eget ligula in metus sodales placerat pretium a dolor. Suspendisse vestibulum erat vitae eros bibendum posuere. Aenean nec augue vitae nisl luctus tempus.'; $pos = 0; $chunkLength = 17; $inputChunkMaxLength = 12 * $chunkLength; $chunkEnd = "\r\n"; $result = ''; $length = strlen($data); while ($pos < $length) { $inputChunk = substr($data, $pos, $inputChunkMaxLength); $encoded = base64_encode($inputChunk); $result .= chunk_split($encoded, $chunkLength, $chunkEnd); $pos += $inputChunkMaxLength; } var_dump($result);
Output for 4.3.0 - 7.1.0
string(5204) "TG9yZW0gaXBzdW0gZ G9sb3Igc2l0IGFtZX QsIGNvbnNlY3RldHV yIGFkaXBpc2Npbmcg ZWxpdC4gSW4gdHJpc 3RpcXVlIG5pc2kgbm liaCwgc2l0IGFtZXQ gdmVoaWN1bGEgZXJv cyBhbGlxdWFtIHV0L iBQaGFzZWxsdXMgYW MgbWF1cmlzIHZlaGl jdWxhLCB2aXZl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