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 = 12; $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(5432) "TG9yZW0gaXBz dW0gZG9sb3Ig c2l0IGFtZXQs IGNvbnNlY3Rl dHVyIGFkaXBp c2NpbmcgZWxp dC4gSW4gdHJp c3RpcXVlIG5p c2kgbmliaCwg c2l0IGFtZXQg dmVoaWN1bGEg ZXJvcyBhbGlx dWFtIHV0LiBQ aGFzZWxsdXMg YWMgbWF1cmlz IHZlaGljdWxh LCB2aXZl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