Monday, March 20, 2017

Get a substring in Laravel PHP

I am currently trying to implement and edit form in my application where the default values are the ones from the item which need to be adjusted. My database encrypts some values and adjusted them before storing. What I need is to get the substring of 5 digits between the :// and . characters of the decrypted value. My form is formatted as:

{!! Form::hidden('id', Lang::get('token.id')); !!}
{!! Form::text('id', Crypt::decrypt($token->url), ['class' => 'form-control', 'maxlength' => 5, 'placeholder' => Lang::get('token.id_placeholder')]); !!}

Could someone help me get the substring of 5 digits between :// and . from the decrypted value to use as a default value in my form?



via Anna Jeanine

Advertisement