Split field comma

Hello,

I am using the output of a field for filtering my vacancies by location:

<?= $job->location() ?>

This ouputs (for example):

london, newyork

Because I use the classes for styling I want to get rid of the comma but remain the space. So I thought to use the split function but it seems not to work:

<?php $job->location()->split(',') ?>

Can anybody help me?

Thanks!

You can implode the array:

<?= implode(' ', $job->location()->split(',')) ?>
1 Like

Thank you!