regdude Posted May 22, 2009 Share Posted May 22, 2009 Hi! $bin .= strlen(decbin(ord($txt_str[$i]))) < 8 ? str_pad(decbin(ord($txt_str[$i])), 8, 0, str_pad_left) : decbin(ord($txt_str[$i])); Got this line, but I don't understand a few things. For starters, it doesn't work, but will find out why after I will understand how it works. I understand all parts except "< 8 ?" and ":". What they do? Link to comment https://forums.phpfreaks.com/topic/159285-solved-php-syntax/ Share on other sites More sharing options...
Maq Posted May 22, 2009 Share Posted May 22, 2009 It's using a ternary operator. The equivalent in an if/else is: if(strlen(decbin(ord($txt_str[$i]))) { $bin .= str_pad(decbin(ord($txt_str[$i])), 8, 0, str_pad_left); } else { $bin .= decbin(ord($txt_str[$i])); } For starters, it doesn't work Can't really help you unless you provide some more information. Link to comment https://forums.phpfreaks.com/topic/159285-solved-php-syntax/#findComment-840093 Share on other sites More sharing options...
regdude Posted May 22, 2009 Author Share Posted May 22, 2009 Thanks! Link to comment https://forums.phpfreaks.com/topic/159285-solved-php-syntax/#findComment-840095 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.