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 = 76; $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(4780) "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4g SW4gdHJpc3RpcXVlIG5pc2kgbmliaCwgc2l0IGFtZXQgdmVoaWN1bGEgZXJvcyBhbGlxdWFtIHV0 LiBQaGFzZWxsdXMgYWMgbWF1cmlzIHZlaGljdWxhLCB2aXZlcnJh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